1
如何打印從URL的響應內容,因爲預覽是空PHP - 捲曲獲得響應主體
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_REFERER, $ref);
curl_setopt($ch, CURLOPT_COOKIEJAR, cookie.txt');
curl_setopt($ch, CURLOPT_COOKIEFILE, cookie.txt');
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 5.1; rv:1.7.3) Gecko/20041001 Firefox/0.10.1");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_fields);
$output = curl_exec($ch);
curl_close($ch);
圖片:
@AliTrixx是不工作...的輸出是不一樣的與響應 –
當調試任何類型的編碼問題時,打開錯誤報告。您提供的代碼應該拋出錯誤,因爲您在cookie文件的名稱之前缺少單引號。當其他人回答時,回顯$ output以在頁面上打印結果。 –