网页资源抓取

// $text=file_get_contents('http://huaban.com/');
// preg_match_all('/<img[^>]*>/i', $text, $match);
// print_r($text);
$keyword = "火影";
$keyword = urlencode($keyword);
$url = "www.baidu.com";
$html = file_get_contents($url);
preg_match_all("/"[^"]*[^0].jpg"/", $html, $text);
foreach ($text as $key => $value) {
foreach ($value as $img) {
$a='www.baidi.com';
$img=substr($img, 1,strlen($img)-2);
// $img=$a.$img;
// var_dump($img);
print "<img src=".$a.$img . " /><br/>";
 
 
}
}
原文地址:https://www.cnblogs.com/linzy/p/6795032.html