Hi,
This is a script I use to get all the images from a webpage.
<?
// this is a take text between $start and $end function.
function in_string($string, $start, $end)
{
ereg($start.".*".$end, $string, $block);
$startlen = strlen($start);
$endlen = strlen($end);
return substr($block[0], $startlen, -$endlen);
}
//This reads the $site in to a string.
$file = join('', file($site));
// now while there's a img tag then do this
while(stristr($file, "<img"))
{
//get img tag
$imgtag = in_string($file, '<img"', '">');
//get src
$imgsrc = in_string($imgtag, 'src="', '"');
//echo img
echo "<img src=\"$imgsrc\">";
//remove the img tag that has just been ripped.
$file = str_replace($imgtag, " ", $file);
}
echo "done";
?>
ok should work.
but i get :
Warning: The length of the needle must not be 0 in c:\phpdev3\www\test2.php on line 26
line 26 being $file = str_replace($imgtag, " ", $file);
i've got no idea!
thanks if you can sovle it!