Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
<?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

This comment has been minimized.

Copy link
Owner Author

@fulldecent fulldecent commented Aug 7, 2016

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
You can’t perform that action at this time.