I am trying to load a dom object and to parse it for finding specific links
Here is my code:
$content = file_get_contents(\"http://www.example.com/example.
Instead of var_dump($xml) try: echo $xml->saveHTML();
This is an example from the manual: DOMDocument
<?php
$content = file_get_contents("http://www.example.com/example.php");
$xml = new DOMDocument();
$xml->loadHTML($content);
// Empty array to hold all links to return
$links = array();
//Loop through each <a> tag in the dom and add it to the link array
foreach($xml->getElementsByTagName('a') as $link) {
$links[] = array('url' => $link->getAttribute('href'), 'text' => $link->nodeValue);
}
print_r($links);
?>