I am scrapping some results, when I scrape, I am getting 50 results. I want to show only first 20 results, below is the code, how to limit results?
require 'simple_html_dom.php';
$url = "http://espncricinfo.com/scores/match-100007";
$html = file_get_html( $url );
$posts = $html->find('div[type=tuple]');
foreach ( $posts as $post ) {
$matchtitle = $post->find('span[class=desigd]',0);
$matchdate = $post->find('span[class=date]',0);
echo $matchtitle;
echo $matchdate;
}