我发现一个站 怎么调 都没法保存生成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 我才先这样测试。其他站都测试成功了 服务器的安全维护技巧五大招 PHP送分题:时间查询的问题 Linux系统下,如何在Apache2中指定php.ini的路径 求教php函数如何回收内存 文件后缀方面的迷茫 我是做Delphi开发的,现在需要用到PHP,问个简单的问题..(结贴率100%) 哪位兄弟能提供一个AJAX的例子给我呢? [*****醒目****]请问如何编写不定参数数目的函数? 用PHP做的比较有名的 文章管理程序 都有哪些阿?? 关于PHP进行模糊查询! 为什么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