Belgin Fish
Belgin Fish

Reputation: 19837

Get Total Results Youtube Api PHP

Hey, well right now I'm parsing youtube's api

demo url :

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

i'm using simplexml_load_file

the thing is, what should i do to retrieve the

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

any ideas?

Thanks

Upvotes: 1

Views: 2283

Answers (1)

Belgin Fish
Belgin Fish

Reputation: 19837

$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;

Upvotes: 5

Related Questions