工作我使用抓取網站下面的代碼的file_get_contents不是從我的服務器
require 'simple_html_dom.php';
$opts = array('http'=>array('header' => "User-Agent:MyAgent/1.0\r\n"));
$context = stream_context_create($opts);
$header = file_get_contents('http://www.cinnetwork.org',false,$context);
print_r($header);
此代碼正確phpfiddle。但是當我從我的服務器使用它時,它說
Warning: file_get_contents(http://www.cinnetwork.org): failed to open stream: Connection timed out
我也嘗試使用捲曲。它也顯示了類似的錯誤。
爲config'allow_url_fopen'打開? – Ghost
allow_url_fopen已打開 –
該代碼適用於其他網站。 –