【发布时间】:2012-01-10 18:00:20
【问题描述】:
以下代码应从 Twitter 获取 xml 提要并回显结果。
<?php
$xml = simplexml_load_file('https://api.twitter.com/1/statuses/user_timeline/QuiteCheesedOff.xml?count=6');
$tweets = $xml->xpath("/statuses/status");
foreach($tweets as $tweet) {
$text = $tweet->text;
$date = $tweet->created_at;
echo '<div>' . $text . '</div>' . '<b>' . $date . '</b>';
}
?>
而是返回 this。
警告: simplexml_load_file(https://api.twitter.com/1/statuses/user_timeline/QuiteCheesedOff.xml?count=6) [function.simplexml-load-file]:无法打开流:HTTP 请求 失败的! HTTP/1.0 400 错误请求 /home/divethe1/public_html/robin-knight.com/wp-content/themes/RIKsoft/index.php 在第 142 行
【问题讨论】:
-
它现在正在工作,原因不明
-
由于未知原因无法再次工作