我的Linux服务器部署的lnmp,里面有个网站,外网可以正常的访问到这个网站,但是现在我需要再网站上加一些第三方的接口,比如淘宝或者qq的第三方接口,会出现报错,返回信息:
Warning: file_get_contents() [function.file-get-contents]: couldn't resolve host name in /www/ip.php on line 22
Warning: file_get_contents(http://ip.taobao.com/service/getIpInfo.php?ip=123.119.114.87) [function.file-get-contents]: failed to open stream: operation failed in /www/ip.php on line 22
提示报错的就是我调用第三方接口的语句:
$json = file_get_contents('http://ip.taobao.com/service/getIpInfo.php?ip='.$ip);
应该是服务器上哪里设置的问题,我在服务器上也不能对其他的域名或者IP进行ping操作,会没反应,一直不通。
网卡里面直接设置的是公网IP,
eth0:4 Link encap:Ethernet HWaddr 84:2B:2B:F9:DF:3F
inet addr:114.113.xx.xxx Bcast:114.113.xx.xxx Mask:255.255.255.192
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
Interrupt:90 Memory:d6000000-d6012800
dns是北京联通的常用dns,机房那边我也问过了,他们说没做任何限制
本回答被提问者和网友采纳