<?php
include 'simple_html_dom.php';
function get_url_contents($url){
$crl = curl_init();
$timeout = 5;
curl_setopt ($crl, CURLOPT_URL,$url);
curl_setopt ($crl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($crl, CURLOPT_CONNECTTIMEOUT, $timeout);
$ret = curl_exec($crl);
curl_close($crl);
return $ret;
}
$url = 'http://rural.nic.in';
$outhtml = get_url_contents($url);
$html= str_get_html($outhtml);
foreach($html->find('li')as $item) {
echo $item."<br>";
}
//print_r($outhtml);
?>
I wish to print only the URLs listed under the tabs separately, which is in the middle of the page. I tried to use "li" in foreach($html->find('li')as $item)
but I did not get the desired result!
Please help! Thanks!