以下代碼將檢索使用CURL在php中檢索的url的正文內容,但不是https。任何人都可以告訴我如何編輯代碼,因爲我需要返回的數據不僅僅是標題。如何使用CURL獲取HTTPS的正文內容
從我在這裏做的測試是結果。你可以看到它有一個內容長度,我只是不知道如何訪問它。
感謝 斯蒂芬
錯誤:0
串(1457)「HTTP/1.1 200 OK日期:星期六,2009年8月01日6點32分11秒格林尼治標準時間服務器:Apache/1.3.41(達爾文)PHP/5.2.4 mod_ssl/2.8.31 OpenSSL/0.9.7l Cache-Control:max-age = 60過期時間:Sat,01 Aug 2009 06:33:11 GMT Last-Modified:Thu,23 Nov 2006 17:44 :53 GMT的ETag: 「97d620-44b-4565de15」 接受範圍:字節的Content-Length:1099連接:關閉的Content-Type:text/html的「
<?php
$curl_handle=curl_init();
$username = "";
$password = "";
$fullurl = "http://www.queensberry.com";
$ch = curl_init();
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_VERBOSE, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_FAILONERROR, 0);
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
curl_setopt($ch, CURLOPT_USERPWD, "$username:$password");
curl_setopt($ch, CURLOPT_URL, $fullurl);
$returned = curl_exec($ch);
curl_close ($ch);
var_dump($returned);
?>
感謝約什 是的,它應該是https://開頭,但是這是沒有問題的。它需要一些額外的參數,我想。我的一位工作人員開始工作。我必須讓他在這裏分享代碼。 謝謝 – 2009-08-11 07:53:58