Created
August 7, 2016 08:23
-
-
Save fulldecent/abf58d508e601f492ad48daf82cf7ca2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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>'; | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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'