2011-08-25 82 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来回扫描已打开的端口 –