curl cookiejar 擷取不到內容,該怎麼解決

來源:互聯網
上載者:User
curl cookiejar 擷取不到內容

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
(
[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
)

顯然跳轉中的形如 (mggxrgvmym2tzn45b5wfkh55) 的路徑是充當 session 的角色的
------解決思路----------------------
頂上說的對啊
  • 聯繫我們

    該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

    如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.