I am using PHP and cURL to extract a website for its images using the <img tag. i would like to know how to loop through the whole page to get all of the images. so far im able to get 1 image but cant figure out how to get all of the images from a website with cURL.

Thank You in advanced.

I am using PHP and cURL to extract a website for its images using the <img tag. i would like to know how to loop through the whole page to get all of the images. so far im able to get 1 image but cant figure out how to get all of the images from a website with cURL.

Thank You in advanced.

You can use a regular expression to match images in the curl response.

eg:

preg_match_all("/<img(.*?)>/i", $html, $matches); 

$imgs = $matches[1];

http://www.php.net/preg_match_all

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.