Ozz Posted November 13, 2006 Share Posted November 13, 2006 I need to count and list image links from a remote page.I tried this code:[CODE]$url = "http://www.siteurl.com/page.html";$file = fopen ("$url", "r");if (!($file)) {echo "Not exist!";exit;}while (!feof ($file)) { $line = fgets ($file, 1024); if (eregi ("HREF=\"(.*).jpg\">", $line, $out)) { $image = $out[1].".jpg"; $pos = strpos($image, "http://");if ($pos === false) { $image_url = dirname($url)."/".$image;} echo $image_url;}}[/CODE] But it's not working stable on different sites especially only works if the image link codes are on one line.Can anyone suggest any code for listing image links?Thanks in advance. Link to comment https://forums.phpfreaks.com/topic/27058-image-link-counting-listing-from-a-remote-page/ Share on other sites More sharing options...
Destruction Posted November 13, 2006 Share Posted November 13, 2006 You may want to look into file_get_contents() function as it will return the whole file in one go.Dest Link to comment https://forums.phpfreaks.com/topic/27058-image-link-counting-listing-from-a-remote-page/#findComment-123762 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.