I basically want to get ALL the images in any website using DOMDocument. but then i cant even load my html due to some reasons I dont know yet.
$url="http://<any_url_here>/";
$dom = new DOMDocument();
@$dom->loadHTML($url); //i have also tried removing @
$dom->preserveWhiteSpace = false;
$dom->saveHTML();
$images = $dom->getElementsByTagName('img');
foreach ($images as $image)
{
echo $image->getAttribute('src');
}
what happens is nothing gets printed . or did I do something wrong with the code?