目前没遇过
但见过一朋友传过header ,并且传了prefer
所以,如果是不是动态cookie,应是可以的
见第三个参数,并设置流 ,stream
看手册

解决方案 »

  1.   

    建议lz做一个HTTP客户程序比较来的直接
    http://framework.zend.com/manual/zh/zend.http.html
      

  2.   

    file_get_contents 不支持.
    但PHP有方法进行COOKIE的提交.
    你百度一下"curl cookie"
      

  3.   

    似乎可以,不过我没使用过file_get_contents的后几个参数。在php中,一般来说,发送cookie使用两种方法,一种是使用socket将cookie信息构造在http头里面的方式,另一种是使用curl里面的COOKIEFILE字段来指定cookie文件的位置。用file_get_contents的还真少见,不过我认为curl比它更好用一些。
      

  4.   

    使用curl里面的COOKIEFILE字段来指定cookie文件的位置。这个比较符合我现在情况, 有这样的例子吗?
      

  5.   

    可以的,例子如下
    <?
    $data = array   
    (   
        'msg_author' => 'poster',
        'msg_body' => 'gsd958gjsj sdj958fdsj',
        'event' => 'comment',
        'pid' => '15',
        'submit' => 'OK',
    );function Post($url, $post = null)   
    {   
        $context = array();   
        if (is_array($post))   
        {   
            ksort($post);   
            $context['http'] = array   
            (   
                'method' => 'POST',
                'header' => 'Cookie: 62be229b68f9a8202715cdd8c7092e31=63b33644fd6ed03214ed3887d7ead743; expires=Wed, 28-Jul-2010 13:53:37 GMT;...',
                'content' => http_build_query($post, '', '&'),   
            );   
        }   
        return file_get_contents($url, false, stream_context_create($context));   
    }   
       
    echo Post('http://domain/post.php', $data);
    ?>