file_get_contents()能否支持页面要求cookie的 目前没遇过但见过一朋友传过header ,并且传了prefer所以,如果是不是动态cookie,应是可以的见第三个参数,并设置流 ,stream看手册 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 建议lz做一个HTTP客户程序比较来的直接http://framework.zend.com/manual/zh/zend.http.html file_get_contents 不支持.但PHP有方法进行COOKIE的提交.你百度一下"curl cookie" 似乎可以,不过我没使用过file_get_contents的后几个参数。在php中,一般来说,发送cookie使用两种方法,一种是使用socket将cookie信息构造在http头里面的方式,另一种是使用curl里面的COOKIEFILE字段来指定cookie文件的位置。用file_get_contents的还真少见,不过我认为curl比它更好用一些。 使用curl里面的COOKIEFILE字段来指定cookie文件的位置。这个比较符合我现在情况, 有这样的例子吗? 可以的,例子如下<?$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);?> PHP Memcache 连接问题! 临时内存表速度很快,但是又不支持text 关于php调用mysql的存储过程的问题 一个简单的问题求解 PHP网站被挂木马,怎么办? php 创建文件失败的?不知道什么原因 PHP根据来路域名显示不同的内容 关于执行变量的值的问题 新人求WIN2000+PHP+Apache+MySql配置方法! 请教各位一个很简单的问题 请问如何批量下载linux下某个目录下的所有文件 给学校保卫处做个网站,大家可有建议的PHP程序?
http://framework.zend.com/manual/zh/zend.http.html
但PHP有方法进行COOKIE的提交.
你百度一下"curl cookie"
<?
$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);
?>