我需要獲取網頁的內容,因爲它沒有啓用,所以我不能使用Curl。我嘗試了下面的代碼但它不工作。如何在沒有CURL的情況下獲取網頁的內容?
$opts = array(
'http'=>array(
'method'=>"GET",
'header'=>"Accept-language: en\r\n" .
"Cookie: foo=bar\r\n"
)
);
$context = stream_context_create($opts);
$fp = fopen($_GET['url'], 'r', false, $context);
if($fp)
fpassthru($fp);
fclose($fp);
exit;
的代碼產生一個錯誤
Warning: fopen(http://www.google.com/search?&q=site:www.myspace.com+-intitle:MySpaceTV+%22Todd Terje%22) [function.fopen]: failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request
我可以說什麼「你規則」:P鷹眼;)。是的,問題是! – Arshdeep 2010-05-31 21:12:55
要將此答案標記爲「您規則」,請單擊左側的綠色勾號標記。 – Douglas 2010-05-31 21:43:15