0
<?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!

2
Contributors
1
Reply
2
Views
5 Years
Discussion Span
Last Post by adam.adamski.96155
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.