curl cookiejar 获取不到内容,该怎么解决
程序员文章站
2022-05-04 09:09:48
...
curl cookiejar 获取不到内容
这段代码是获取验证码加上cookie得可是每次看cookieImage文件都是空得
这是为什么?[yabao=][/yabao][yabao=][/yabao]
------解决思路----------------------
------解决思路----------------------
顶上说的对啊
curlImage();
function curlImage(){
$cookieJar=tempnam('tmp', cookieImage);
$ch=curl_init("http://124.160.104.166/(1jovmraaf1pemj55dkr01ebo)/CheckCode.aspx");
curl_setopt($ch, CURLOPT_COOKIEJAR, $cookieJar);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$image=curl_exec($ch);
curl_close($ch);
$fp=fopen("image.gif", "w+");
fwrite($fp, $image);
}
这段代码是获取验证码加上cookie得可是每次看cookieImage文件都是空得
这是为什么?[yabao=][/yabao][yabao=][/yabao]
------解决思路----------------------
print_r(get_headers('http://124.160.104.166/'));
Array显然跳转中的形如 (mggxrgvmym2tzn45b5wfkh55) 的路径是充当 session 的角色的
(
[0] => HTTP/1.1 302 Found
[1] => Connection: close
[2] => Date: Thu, 02 Oct 2014 03:05:03 GMT
[3] => Server: Microsoft-IIS/6.0
[4] => X-Powered-By: ASP.NET
[5] => X-AspNet-Version: 1.1.4322
[6] => Location: /(mggxrgvmym2tzn45b5wfkh55)/default2.aspx
[7] => Cache-Control: private
[8] => Content-Type: text/html; charset=gb2312
[9] => Content-Length: 158
[10] => HTTP/1.1 200 OK
[11] => Connection: close
[12] => Date: Thu, 02 Oct 2014 03:05:04 GMT
[13] => Server: Microsoft-IIS/6.0
[14] => X-Powered-By: ASP.NET
[15] => X-AspNet-Version: 1.1.4322
[16] => Pragma: no-cache
[17] => Cache-Control: no-cache
[18] => Pragma: no-cache
[19] => Expires: -1
[20] => Content-Type: text/html; charset=gb2312
[21] => Content-Length: 4091
)
------解决思路----------------------
顶上说的对啊
相关文章
相关视频
上一篇: 微信支付开发(11) Native支付,native支付_PHP教程
下一篇: undefined function: [php] Call to undefined function bccomp
推荐阅读