我有一些JS调用一行PHP:
<?php echo file_get_contents($_GET['url']); ?>
从NOAA获取天气信息,然后将其传递给JS。
JS和PHP出现(对我来说)在我的主机上工作了好四个月左右。今天,当我从服务器上加载我网站上的页面时遇到问题,我看到了这个错误:
[16-Aug-2016 20:53:32 UTC] PHP Warning: file_get_contents(http://weather.noaa.gov/pub/data/forecasts/marine/weather_stmt/an/anz431.txt): failed to open stream: php_network_getaddresses: getaddrinfo failed: Temporary failure in name resolution in /home/gratefu2/public_html/poseidonweather.com/grabber.php on line 1
通过查看错误日志,我现在意识到在过去的四个月中发生了几十次相同的错误。相比之下,它今天发生了几百次。
我没有遇到问题在我的localhost上运行相同的代码。我的托管服务提供商说他们可以从他们的服务器ping noaa.gov。他们声称这是我的代码的问题,而不是与他们的网络相关的东西:
I've just checked and noaa.gov domain name correctly resolves from the server where your account resides. Looks like the problem is related directly to your software.
I'm sorry, I would love to help you out here, but you have to understand that we do not make the software or CMS and its not possible for us to fix this for you. You will have to speak to the creator of the CMS to get the best possible support.
我有什么东西可以忽略代码吗?或者他们的问题是什么?还有其他的东西吗?