QuestionsData scrapping PHP
mmvikram kumar asked 2 months ago

$url = ‘http://www.webetutorial.com/codeigniter-tutorial’;

$doc = new DomDocument;
// We need to validate our document before refering to the id
$doc->validateOnParse = true;
$doc->loadHtml(file_get_contents($url));

//print_r($rmbd);

$html = $doc->getElementById(‘city’);
$flag= TRUE;
$content = array();
$i = 0;
$item = array();

foreach($html->getElementsByTagName(‘div’) as $tr) {
print_r($tr->nodeValue);
}

Your Answer
Login
Enter email and password to comment or answer
Not the answer you are looking for? Browse other questions tagged or ask your own question.