当我在youtube脚本中搜索视频时,我(偶尔)收到此错误,其他时候它只是工作,但问题再次出现。有人可以帮助我解决这个问题吗?
错误信息:
Warning: simplexml_load_file(http://gdata.youtube.com/feeds/api/videos?vq=music&orderby=relevance&max-results=10&start-index=201&lr=en): failed to open stream: HTTP request failed! HTTP/1.0 403 Forbidden in /home/website/public_html/search.php on line 119
Warning: simplexml_load_file(): I/O warning : failed to load external entity "http://gdata.youtube.com/feeds/api/videos?vq=music&orderby=relevance&max-results=10&start-index=201&lr=en" in /home/website/public_html/search.php on line 119
Fatal error: Call to a member function children() on a non-object in /home/website/public_html/search.php on line 122
119行:
$sxml = simplexml_load_file($feedURL);
122行:
$counts = $sxml->children('http://a9.com/-/spec/opensearchrss/1.0/');
Youtube 正在限制您的自动请求,这就是为什么"偶尔"脚本不起作用的原因......请改用 YouTube API。