开发者

Get URL image content using php

开发者 https://www.devze.com 2023-03-01 05:43 出处:网络
I have a url like this. http://www.cardekho.com/ If i w开发者_StackOverflow社区ish to get all the image content(jpg,png,gif - only images) from this url to my local machine(C:\\images) - How to do th

I have a url like this. http://www.cardekho.com/

If i w开发者_StackOverflow社区ish to get all the image content(jpg,png,gif - only images) from this url to my local machine(C:\images) - How to do this..

Please help me. Thanks - Haan


Use either cURL or PHP function file_get_content to get the source code and the source code for the css (if you want to get background-images aswell).

Then use preg_match_all and match all the image tags.

Loop all found image paths and use cURL or file_get_content to save the image to a local destination.

0

精彩评论

暂无评论...
验证码 换一张
取 消