How to get the totalResults entry from the YouTube video API
I'm using PHP and the YouTube API to get videos from YouTube to feed to my web app, but I don't know how to get the totalResults
entry
Here is my code:
$yt = new Zend_Gdata_YouTube();
$query = $yt->newVideoQuery();
$query->setQuery($searchTerm);
$query->setStartIndex($startIndex);
$query->setMaxResults($maxResults);
开发者_开发百科$feed = $yt->getVideoFeed($query);
echo $feed->totalResults; // this desn't work
The element itself is protected; you need to use the getTotalResults accessor:
echo $feed->getTotalResults();
精彩评论