Skip to content

Instantly share code, notes, and snippets.

@fulldecent
Created August 7, 2016 08:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fulldecent/abf58d508e601f492ad48daf82cf7ca2 to your computer and use it in GitHub Desktop.
Save fulldecent/abf58d508e601f492ad48daf82cf7ca2 to your computer and use it in GitHub Desktop.
<?php
# My hack from 2003, probably still works
$mail = $_GET['mail'];
if ($mail)
{
$image = "wildcardphotos/$mail.jpg";
if (!file_exists ($image))
{
$getURL="http://wildcardphotos.villanova.edu/servlet/ViewPhoto?mail=$mail";
$refURL="http://www.villanova.edu/villanovaWeb/control/viewClassroom/SPR-2000-024";
$uagent="Mozilla/4.0 (compatible; MSIE 5.0; Windows NT)";
exec("wget -U \"${uagent}\" \"${getURL}\" --refer=\"${refURL}\" --output-document=\"${image}\"");
$size = filesize($image);
if ($size == 8130 || $size == 0) // the "Photo not avail" picture
unlink($image);
}
if (file_exists ($image))
{
echo "$mail = <img height=200 src=\"$image\">";
}
else
{
echo 'not found';
}
}
else
{
echo '<p>Enter a Villanova email address to get their photo.</p><form><input name="mail"><input type=submit>';
}
?>
@fulldecent
Copy link
Author

This had a caching system to avoid duplicate downloads. It was part of HackNova which was basically Facebook before Facebook came out. Anyway, probably easier to just run like:

wget -U 'Mozilla/4.0 (compatible; MSIE 5.0; Windows NT)' --refer 'http://www.villanova.edu/villanovaWeb/control/viewClassroom/SPR-2000-024' 'http://wildcardphotos.villanova.edu/servlet/ViewPhoto?mail=$EMAIL'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment