使用PHP爬取网站图片

<?php
if ($_SERVER["REQUEST_METHOD"] == "GET") {  
$url = $_GET["url"];
if(!empty($url)){
$content = file_get_contents($url); 
$pattern="/<[img|IMG].*?src=[\'|\"](.*?(?:[\.gif|\.jpg]))[\'|\"].*?[\/]?>/";
preg_match_all($pattern,$content,$list);
foreach ($list as $key => $value) {
foreach ($value as $k=>$v) {
echo $v;
}   }
}    }
?>

php爬取图片.png

滇ICP备16003699号-2
最后修改:2018 年 11 月 03 日
如果觉得我的文章对你有用,请随意赞赏