Skip to content Skip to sidebar Skip to footer

External Url Get Image

I am using simple html dom for parsing an external url and getting images from it. I can get images from 80% externals urls but some of them gives problems. Example Below. $url = '

Solution 1:

use the below script

$url="http://example.com";

$html = file_get_contents($url);

$doc = new DOMDocument();
@$doc->loadHTML($html);

$tags = $doc->getElementsByTagName('img');

foreach ($tags as $tag) {
       echo $tag->getAttribute('src');
}

Post a Comment for "External Url Get Image"