views:

53

answers:

1

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
A: 

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

echo $feed->getTotalResults();
Michael Mrozek
thanks! it works:<pre>echo $feed->getTotalResults()->text;</pre>
ohana