0
我遇到了一個奇怪的問題。我正忙於使用PHP cURL,並且我有一個我無法打開的網站。cURL PHP和cURL
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
@unlink("/tmp/cookies.txt");
curl_setopt($ch, CURLOPT_COOKIEFILE, "/tmp/cookies.txt");
curl_setopt($ch, CURLOPT_COOKIEJAR, "/tmp/cookies.txt");
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 30);
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_REFERER, "http://www.gmail.com");
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.1) Gecko/20061204 Firefox/3.5.0.1");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$page = curl_exec($ch);
$info = curl_getinfo($ch);
$信息返回:
[url] => MASKED
[content_type] =>
[http_code] => 0
[header_size] => 0
[request_size] => 0
[filetime] => -1
[ssl_verify_result] => 0
[redirect_count] => 0
[total_time] => 0
[namelookup_time] => 0
[connect_time] => 0
[pretransfer_time] => 0
[size_upload] => 0
[size_download] => 0
[speed_download] => 0
[speed_upload] => 0
[download_content_length] => -1
[upload_content_length] => -1
[starttransfer_time] => 0
[redirect_time] => 0
我的服務器經常捲曲安裝。 所以如果我做 curl domain.com
它的工作原理! 這是相同的域名。 我試着清理防火牆,並且還有cURL使用FRESH_CONNECT,因此它爲域取得最新的IP。 還是不行。想法?
是的,我做到了。我還添加了很多額外的設置,例如詳細顯示,我無法弄清楚。對不起,沒有域,因爲它在開發服務器上運行。 – 2011-05-18 18:13:29