Skip to content

Instantly share code, notes, and snippets.

@vmunhoz
Created August 5, 2013 05:13
Show Gist options
  • Save vmunhoz/6153657 to your computer and use it in GitHub Desktop.
Save vmunhoz/6153657 to your computer and use it in GitHub Desktop.
Using DOM objects PHP
<?php
$doc = new DOMDocument();
$doc->loadHTML('<img src="http://example.com/img/image.jpg" ... />');
$imageTags = $doc->getElementsByTagName('img');
foreach($imageTags as $tag) {
echo $tag->getAttribute('src');
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment