Thursday, April 11, 2013

Get all image source of html file using dom in php


<?php
    $doc = new DOMDocument();
    $doc->loadHTML(htmlstring);
    $imageTags = $doc->getElementsByTagName('img');

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

No comments:

Post a Comment

Thank you for your Comment....

Popular Posts