我发现一个站 怎么调 都没法保存生成cookie文件,求大神指点 $file_path ['dirname']是否有写权限? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 肯定有的。。试了几个站 就这个站保存不了cookie头文件返回Connection: close 不知是什么意思 HTTP/1.1 200 OKConnection: closeDate: Sat, 05 Jul 2014 04:19:54 GMTServer: Microsoft-IIS/6.0X-UA-Compatible: IE=EmulateIE7X-Powered-By: ASP.NETX-Powered-By: PHP/5.2.17Content-Type:text/html;charset=utf-8 测试一下$url = 'http://www.go9go.cn/member/login.php';print_r(get_headers($url));$url = 'http://www.go9go.cn/';print_r(get_headers($url));得Array( [0] => HTTP/1.1 200 OK [1] => Connection: close [2] => Date: Sat, 05 Jul 2014 05:02:38 GMT [3] => Server: Microsoft-IIS/6.0 [4] => X-UA-Compatible: IE=EmulateIE7 [5] => X-Powered-By: ASP.NET [6] => X-Powered-By: PHP/5.2.17 [7] => Content-Type:text/html;charset=utf-8)Array( [0] => HTTP/1.1 200 OK [1] => Refresh: 30; URL=http://www.go9go.cn/ [2] => Content-Type: text/html [3] => Connection: close [4] => Expires: 0 [5] => Cache-control: no-store,no-cache,must-revalidate,post-check=0,pre-check=0)可知两个 url 都没有主动设置 cookie所以 cookie 应由 http://www.go9go.cn/member/login.php 的目标页设置的即便是其中有一个设置了 cookie,而你没有curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie_file);所以curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie_file);得到的 cookie 也不会发送回去 curl_tms('http://www.go9go.cn/member/login.php');抓这个页面还是没有生成cookie啊 http://www.go9go.cn/member/login.php 只是在登录成功时才会有 cookie 设置你没有登录,自然也就得不到 cookie 就是登陆获取不到cookie 我才先这样测试。其他站都测试成功了 IE输入http://localhost网页自动转到另外的网页 快速学会PHP的方法! 抓取网页信息图片不能正常显示 windwos下配置php+IIS+MYSQL,验证码问题? 跪求 textarea输出结果 IE浏览器下复制出来不换行 关于PHP生成RSS显示中文的问题. linux下world writable 是什么权限?怎么设置啊? 在线求助--服务器更换后,php运行出错! 如何对phpmyadmin目录进行登陆认证保护??????? PHP MYSQL查询的问题 为什么APACHE设置了多站点,重写模块就失效了? 求助这段代码改成判断域名的
头文件返回Connection: close 不知是什么意思
Connection: close
Date: Sat, 05 Jul 2014 04:19:54 GMT
Server: Microsoft-IIS/6.0
X-UA-Compatible: IE=EmulateIE7
X-Powered-By: ASP.NET
X-Powered-By: PHP/5.2.17
Content-Type:text/html;charset=utf-8
print_r(get_headers($url));
$url = 'http://www.go9go.cn/';
print_r(get_headers($url));
得Array
(
[0] => HTTP/1.1 200 OK
[1] => Connection: close
[2] => Date: Sat, 05 Jul 2014 05:02:38 GMT
[3] => Server: Microsoft-IIS/6.0
[4] => X-UA-Compatible: IE=EmulateIE7
[5] => X-Powered-By: ASP.NET
[6] => X-Powered-By: PHP/5.2.17
[7] => Content-Type:text/html;charset=utf-8
)
Array
(
[0] => HTTP/1.1 200 OK
[1] => Refresh: 30; URL=http://www.go9go.cn/
[2] => Content-Type: text/html
[3] => Connection: close
[4] => Expires: 0
[5] => Cache-control: no-store,no-cache,must-revalidate,post-check=0,pre-check=0
)可知两个 url 都没有主动设置 cookie
所以 cookie 应由 http://www.go9go.cn/member/login.php 的目标页设置的即便是其中有一个设置了 cookie,而你没有
curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie_file);
所以
curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie_file);
得到的 cookie 也不会发送回去
抓这个页面还是没有生成cookie啊
你没有登录,自然也就得不到 cookie