How to get totalResults record from YouTube video API

I am using PHP and YouTube API to get YouTube videos to feed to my web app, but I don't know how to get the recording totalResults

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

      

+2


a source to share


1 answer


The element itself is protected; you need to use getTotalResults accessor:



echo $feed->getTotalResults();

      

0


a source







All Articles