2011-08-25 81 views
3

我使用了下面的代碼。使用file_get_contents時出現警告

$ homepage = file_get_contents('http://www.google.co.in/'); echo $ homepage;

但它顯示以下警告消息

警告:的file_get_contents(http://www.google.co.in/)[function.file-GET-內容]:未能打開流:失敗HTTP請求!在上線/home/web/cron/sample.php在php.ini 47

回答

1
  1. 檢查設置於allow_url_fopen
  2. 檢查DNS設置。
  3. 檢查防火牆設置
+0

我不知道如何和什麼樣的DNS和防火牆設置請提供有關的一些信息進行檢查。 –

+0

看看http://www.linuxhomenetworking.com/wiki/index.php/Quick_HOWTO_:_Ch18_:_Configuring_DNS DNS –

+0

看看http://www.cyberciti.biz/tips/linux-scanning-network-for-open -ports.html來回掃描已打開的端口 –