I am saving data in a array with max index 50. Now the problem is I am displaying only 10 results first. There is a button "view more". What I am trying to do is whenever I press view more it should display next 10 results from array and so on. All the data is saved in an array $data
.
Here is the code:
$lastindex=$_POST['ID'];
$data =array();
$file = file_get_contents('http://gdata.youtube.com/feeds /base/videos?max-results=50&lr=es&q=football&client=ytapi-youtube-search&v=2');
$rss = new SimpleXMLElement($file);
$limit = '50'; //Videos Limit to display
$ctr = '0';
$i=1;
foreach($rss->entry as $idx => $key)
{
if($ctr == $limit)
{
break;
}
else
{
echo '<div>';
$content = str_replace("watch?v=","v/", $key->content) ;
$data[$i]=$content;
$i++;
echo '</div>';
$ctr++;
}
}