相关的错误(这显示在您链接到页面的页脚)是:
Warning: SimpleXMLElement::__construct(http://twitter.com/users/show/tuscaroratackle.xml) [simplexmlelement.--construct]: failed to open stream: HTTP request failed! HTTP/1.1 400 Bad Request in /home5/tuscaror/public_html/footer.php on line 47
Warning: SimpleXMLElement::__construct() [simplexmlelement.--construct]: I/O warning : failed to load external entity "http://twitter.com/users/show/tuscaroratackle.xml" in /home5/tuscaror/public_html/footer.php on line 47
Fatal error: Uncaught exception 'Exception' with message 'String could not be parsed as XML' in /home5/tuscaror/public_html/footer.php:47 Stack trace: #0 /home5/tuscaror/public_html/footer.php(47): SimpleXMLElement->__construct('http://twitter....', 0, true) #1 /home5/tuscaror/public_html/index.php(119): include('/home5/tuscaror...') #2 {main} thrown in /home5/tuscaror/public_html/footer.php on line 47
的第一个警告告诉你发生了什么:“HTTP请求失败,HTTP/1.1 400错误的请求” 。
因此,出于某种原因,您的服务器在向HTTP发送请求以检索文档"http://twitter.com/users/show/tuscaroratackle.xml"
时失败。返回码是400 Bad Request
。
我刚刚尝试了来自我的网络浏览器的相同请求,并且它运行良好,所以无论是暂时“外出吃午饭”(时常发生),还是您的服务器的网络配置都有一些独特的。我的第一个猜测是,从你的服务器上传到某个地方,某人已经安装了一个HTTP代理,它是(出于某种未知的原因)阻止你的请求。
这里是twitter has to say about it:
400 Bad Request: The request was invalid. An accompanying error message
will explain why. This is the status code will be returned during rate limiting.
Here is twitter's page on Rate Limiting。我怀疑这是你的罪魁祸首。如果您不这么想,那么您可以试着将文档作为字符串检索并在之前检查它,然后尝试解析它,以便可以看到该消息是什么。
这是快速和肮脏的,但它会得到的消息,所以你可以看到发生了什么事情:
$str = file_get_contents('http://twitter.com/users/show/tuscaroratackle.xml');
echo $str;
,可能会由于400响应代码。如果是这样,您需要使用php curl来获得未解析的响应主体。
祝你好运!
来源
2010-10-30 22:26:16
Lee
我一直在开发现场(即大量重新加载) - 它可能与API限制有关吗? – 2010-10-30 22:17:08
如果您在浏览器中打开http://twitter.com/users/show/tuscaroratackle.xml,会发生什么情况? – 2010-10-30 22:20:29
是的。请参阅下面的答案。 ;-) – Lee 2010-10-30 22:26:57