Вопрос

I get this error (occasionally) when I'm searching videos in youtube script, other times it just works, but then the problem appears again. Can someone help me to fix this issue?

Error Message:

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 

Line 119:

$sxml = simplexml_load_file($feedURL);

Line 122:

$counts = $sxml->children('http://a9.com/-/spec/opensearchrss/1.0/');
Это было полезно?

Решение

Youtube is restricting your automated requests, that's why "occasionally" the script doesn't work... use youtube api instead.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top