Web Content: Crawl Image Source a Web Page
Web Content Tips - Part 8: At the previous post, we crawl and show all url in a web page. Now, we want to filter, crawl only for images. You can modify preg_match_all like this:
<?php
$url = "http://localhost:8048/blog/index.php";
$data = file_get_contents($url);
preg_match_all("/(src)=(\"|')*[^<>[:space:]]+[[:alnum:]#?\/&=+%_]/", $data, $match);
$list = $match[0];
print_r($list);
?>
blog comments powered by Disqus

