<?php //$url="http://www.askmen.com/fine_living/wine_dine_archive_500/520_mezcal-and-tequila.html"; $url="http://en.wikipedia.org/wiki/Wonders_of_the_World"; $url2=""; $html = file_get_contents($url); preg_match("/<img .+?\/>/",$html, $result); //print_r($result); for($x=0;$x<count($result);$x++) { echo $result[0]; } ?>
$url="http://www.annkristinhaugen.no"; $html = file_get_contents($url); preg_match("/<img .+?\/>/",$html, $result); $doc=new DOMDocument(); @$doc->loadHTML($html); $xml=simplexml_import_dom($doc); // just to make xpath more simple $images=$xml->xpath('//img'); $arr=array(); foreach ($images as $img) { $arr[]=$img['src']; } for($x=0;$x<count($arr);$x++) { ?> <?php //echo $arr[$x][0];?> <img src="<?php echo $arr[$x][0];?>" width="150" height="150"/> <?php } ?>
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)