Maison > Article > développement back-end > curl cookiejar 获取不到内容,该怎么解决
curl cookiejar 获取不到内容
<?php<br /><br />curlImage();<br />function curlImage(){<br /> $cookieJar=tempnam('tmp', cookieImage);<br /> $ch=curl_init("http://124.160.104.166/(1jovmraaf1pemj55dkr01ebo)/CheckCode.aspx");<br /> curl_setopt($ch, CURLOPT_COOKIEJAR, $cookieJar);<br /> curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);<br /> $image=curl_exec($ch);<br /> curl_close($ch);<br /> $fp=fopen("image.gif", "w+");<br /> fwrite($fp, $image);<br /><br />}<br />
print_r(get_headers('http://124.160.104.166/'));
Array<br />(<br /> [0] => HTTP/1.1 302 Found<br /> [1] => Connection: close<br /> [2] => Date: Thu, 02 Oct 2014 03:05:03 GMT<br /> [3] => Server: Microsoft-IIS/6.0<br /> [4] => X-Powered-By: ASP.NET<br /> [5] => X-AspNet-Version: 1.1.4322<br /> [6] => Location: /(mggxrgvmym2tzn45b5wfkh55)/default2.aspx<br /> [7] => Cache-Control: private<br /> [8] => Content-Type: text/html; charset=gb2312<br /> [9] => Content-Length: 158<br /> [10] => HTTP/1.1 200 OK<br /> [11] => Connection: close<br /> [12] => Date: Thu, 02 Oct 2014 03:05:04 GMT<br /> [13] => Server: Microsoft-IIS/6.0<br /> [14] => X-Powered-By: ASP.NET<br /> [15] => X-AspNet-Version: 1.1.4322<br /> [16] => Pragma: no-cache<br /> [17] => Cache-Control: no-cache<br /> [18] => Pragma: no-cache<br /> [19] => Expires: -1<br /> [20] => Content-Type: text/html; charset=gb2312<br /> [21] => Content-Length: 4091<br />)<br /><br />显然跳转中的形如 (mggxrgvmym2tzn45b5wfkh55) 的路径是充当 session 的角色的