ohitsme Posted November 23, 2008 Share Posted November 23, 2008 Hi, I grab the contents of a page of galleries (eg, http://www.example.com/galleries/gallery.htm). Then i want to grab the images on it. Normally this is ok, as I assume the images are in the same directory as the html file, so i just do file_get_contents(str_replace("gallery.htm","",$url) . "1.jpg") But sometimes the images are like <img src="../otherdirectory/1.jpg"> or <img src="http://static.example.com/gals/1.jpg"> How can i work out what is the correct url to retrieve? (at the moment i have an array of the contents of all src="" (eg, 1 => 1.jpg 2 => 2.jpg or 1 => http://static.example.com/1.jpg 2 => http://static.example.com/2.jpg or 1 => ../otherdir/1.jpg 2 => ../otherdir/2.jpg (this isn't for any illegal scraping or whatever. It just saves me a manual task i have to do every day) thanks Quote Link to comment Share on other sites More sharing options...
Guldstrand Posted July 15, 2009 Share Posted July 15, 2009 I´m wondering the same thing. Is there a way to grab both the thumbnail AND the original image? Maybe some code that can scrape 2 level depth, or following links somehow? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.