I love writing robots that collect pictures of men, this one was not much of a challenge but resulted in a net gain of 30,000 pics for my robot library.
This one was very simple. It basically loops through, visits the pages, checks to see if there is a photo on the page and then saves the photo based on the category if it exists. Sometimes the robots are much more elaborate. It wasn't even worth writing a class because the code required wasn't more than could go in one method.
There are two photo examples down below the code are of au naturel vintage men, although they are no more offensive than the statue of david. Don't scroll if you don't want to see it.
<?
$dir = 'xpics/';
if(!is_dir($dir)){
mkdir($dir);
}
foreach(range(1, 30423) as $x){
//grab html
$html = file_get_contents('http://SOMEWEBSITE/postcontent/showfull.php?photo='.$x);
if(strstr($html, "Photo not found in the database!")){
echo "Pic ".$x.' not found';
continue;
}
//get photo name
preg_match("~http://SOMEWEBSITE/postcontent/data/(d+)/(.*?)"~", $html, $data);
$src = str_replace('"', '', $data[0]);
$category = $data[1];
$name = $data[2];
$category_dir = $dir.$category.'/';
if(!is_dir($category_dir)){
mkdir($category_dir);
}
$jpeg = file_get_contents($src);
file_put_contents($category_dir.$name, $jpeg);
echo "Saved pic #".$x;
}
?>
What is the story behind this one?
I think it is actually a common amount of chemcials. Homes and automobiles seems to have lots of chemical requirements.
Did home-bomb-makers live there before you?!! They look deadly. I hope you were wearing your mask and gloves when you handled them.
I don't think there were any cleaning chemicals. They were most home repair, roofing, automatics and fuel chemicals. 90% of which were here when we moved in.
Were they all cleaning chemicals? What were they?