我正在尝试使用 vimeos API 通过其 XML 文件调用视频的名称。如果我将此代码用于一个 xml 文件,它可以工作文件:
$location = "http://vimeo.com/api/v2/video/16417063.xml";
$xml = simplexml_load_file($location);
echo $xml->video->title;
但是在我将所有 vimeo 视频 ID 存储在数据库中并使用以下代码之后:
<?php
$seasontwo=mysql_query("SELECT s2 FROM video_ids LIMIT 1");
while($row=mysql_fetch_array($seasontwo))
{
$headline=$row['s2'];
$location = "http://vimeo.com/api/v2/video/".$headline.".xml";
$xml = simplexml_load_file($location);
echo $xml->video->title;
}
?>
我得到错误:
Warning: simplexml_load_file(http://vimeo.com/api/v2/video/16417063.xml) [function.simplexml-load-file]: failed to open stream: HTTP request failed! HTTP/1.1 429 Too Many Requests in /home/dpnews0/public_html/tnn/wordpress/wp-content/themes/twentytwelve/content.php on line 11
Warning: simplexml_load_file() [function.simplexml-load-file]: I/O warning : failed to load external entity "http://vimeo.com/api/v2/video/16417063.xml" in /home/dpnews0/public_html/tnn/wordpress/wp-content/themes/twentytwelve/content.php on line 11
尽管 xml 文件http://vimeo.com/api/v2/video/16417063.xml实际上是有效的。谁能帮我这个?