我使用下面的代碼CURLOPT_NOBODY不工作
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $real_url);
curl_setopt($ch, CURLOPT_COOKIE, $cookie);
curl_setopt($ch, CURLOPT_NOBODY, true);
curl_setopt($ch, CURLOPT_COOKIEFILE, $fscookiefile);
curl_setopt($ch, CURLOPT_COOKIEJAR, $fscookiefile);
curl_setopt($ch, CURLOPT_HEADER, TRUE);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, false);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, FALSE);
curl_setopt($ch, CURLOPT_TIMEOUT, 60);
curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.13) Gecko/20101206 Ubuntu/10.04 (lucid) Firefox/3.6.13 GTB7.1');
$r = curl_exec($ch) or die('WHY DOES THIS DIE!!!');
curl_close($ch);
總是導致爲什麼會出現這種DIE!或頁面加載保持了一段時間,然後會顯示什麼,如果我不使用 或死亡(「爲什麼會發生這種DIE!」)
如果我設置CURLOPT_NOBODY假
我得到
HTTP/1.1 200 OK Date:Thu,09 Jun 2011 01:35:07 GMT Pragma:public Expires:0 Cache-Control:must-revalidate,post-check = 0,pre-check = 0,private =內容類型:應用程序/強制下載Content-Transfer-Encoding:二進制Keep-Alive:1000 Content-Disposition:attachment; filename * = UTF-8'Ever17.part3.rar Accept-Ranges:bytes Content-Length:520000000 Server:Jetty(6.1.16)Rar!zssdt NP ( &R %G 65, Ever17\ Ever_17 __ _The_Out_of_Infinity_CD3.iso 「j M K U: b 2Q sT?G +iM qN ' & -d z }xi < 3\ d �Z:|�/���@�gl��$��[email protected]��u�וۊ \�
jմg ) L #& ; 5M s} ( Đ$ yGwӏ$ E $ Z :/ r͐ 8 & #Q 00 > ) n ̌}o H 2Z y S㞝 H = 9 [ E nЭ \ 9Ǘ!{&y j/ Ȇg FW 〜G 5 F-& ƭ 9< ^7 ( HY(a % ɚQYL_ ܽ X | &
爲什麼我沒有得到任何輸出與CURLOPT_NOBODY設置爲真? ??
我使用在Apache/2.2.3 PHP 5.1.6,並捲曲7.15.5-9.el5_6.2.i386安裝
***爲什麼這個死!????? *** – raidenace 2012-11-05 22:13:48
你訪問什麼URL? – kehers 2014-04-04 11:57:31