Sunday, 25 August 2013

PHP Simple HTML DOM Getting ONLY first 5 links inside a div class

PHP Simple HTML DOM Getting ONLY first 5 links inside a div class

So far I have this
<?PHP include('simple_html_dom.php');
$html = file_get_html('http://www.mangastream.com/');
foreach($html->find('.side-nav') as $t)
foreach($t->find('a')as $k)
echo $k->href . '<br>';
?>
which outputs all the links from inside the class. but I just want to have
the first 5 links.

No comments:

Post a Comment