PDA

View Full Version : HTML parsing (PHP script)



culter
16 May 2011, 01:06 PM
Hello, I need to grab some data from another site which are within <div> tag. I have really miserable knowledge of php, so please be patient and clear:) I have found this script, which may be the one, but it displays nothing but
"object(DOMElement)[2]". At least I need to display that info on the screen.


<?php

$doc = new DomDocument;

// We need to validate our document before refering to the id
$doc->validateOnParse = true;
$doc->loadHtml(file_get_contents('http://nettrans.sk'));

var_dump($doc->getElementById('kontakt'));

?>

Thank you!