2011-04-30 130 views
1

嘿,那么现在我解析YouTube的API获得总结果YouTube API取得PHP

演示网址:

http://gdata.youtube.com/feeds/api/videos/-/test?orderby=viewCount&start-index=1&max-results=50 

我使用使用simplexml_load_file

的事情是,我应该怎么做检索

<openSearch:totalResults>9477</openSearch:totalResults> 

有什么想法吗?

感谢

回答

5
$feedURL = "http://gdata.youtube.com/feeds/api/videos?q=test&orderby=viewCount&start-index=1&max-results=1"; 
$sxml = simplexml_load_file($feedURL); 
$counts = $sxml->children('http://a9.com/-/spec/opensearchrss/1.0/'); 
$total = $counts->totalResults; 
+2

我使用'V = 2'这种方法是行不通的。任何想法如何让这个'v2'? – mgPePe 2012-06-23 16:40:00