This is the PHP-Code for an Image-Grabber for the Geek-Hero-Comic:
function isValidURL($url) { return preg_match('|^http(s)?://[a-z0-9-]+(.[a-z0-9-]+)*(:[0-9]+)?(/.*)?$|i', $url); } $followpage='http://www.geekherocomic.com/2008/03/04/03042008/'; while (!empty($followpage)){ if (isValidURL($followpage)){ $page = file_get_contents($followpage); $picapttern = '|<img src=.*?comics\/(.*?)" alt=.*?>|U'; preg_match_all($picapttern, $page, $match); $pictures[] = $match[1][0]; $nextpattern='|href="(.*?)"><img.*?next.png.*?|U'; preg_match_all($nextpattern,$page,$nextmatch); if (empty($nextmatch[1][0])){ $followpage=""; echo "error:"; print_r($nextmatch); } else { $followpage=$nextmatch[1][0]; } } } foreach ($pictures as $pic){ exec("wget http://www.geekherocomic.com/comics/". $pic); }