Download of webpage, including images

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
dwessell
Forum Commoner
Posts: 62
Joined: Fri Dec 23, 2005 2:30 pm

Download of webpage, including images

Post by dwessell »

Hi,

I'm trying to figure out how to grab the contents of a webpage, inlcuding the images.. It's a small page, it only contains two images. However the name and the src of those two images is different each time, so I can't simply do a wget or a curl for those images.

I had though I could use curl, and just get the webpage, but that grabs the html, and not the images.. Can someone point me in the right direction?

Thanks
David
patrickmvi
Forum Commoner
Posts: 32
Joined: Mon Jun 22, 2009 6:45 am
Location: Fort Lauderdale, FL

Re: Download of webpage, including images

Post by patrickmvi »

You should use CURL to first grab the web page and then parse then extract the image names you need to download using REGEX and then download the files separately either using something like wget or file_get_contents with remote requests enabled.
Post Reply