vinod kumar vinod kumar - 1 year ago 105
PHP Question

How to get image from any website with url

I need to get image url only from any webpage with php nothing can i get image url please help.

I have try

but its not usefull for me.

Thanks in advance

Ram Ram
Answer Source
$html = file_get_contents($url);
$doc = new DOMDocument();
$tags = $doc->getElementsByTagName('img');
foreach ($tags as $tag) {
echo $tag->getAttribute('src');

Check this code its working for me.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download