Created
August 6, 2011 13:36
-
-
Save ivuorinen/1129342 to your computer and use it in GitHub Desktop.
fingerpori emailer
This file contains hidden or 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 | |
$p = "http://www.hs.fi/fingerpori/"; | |
$p = file_get_contents($p); | |
preg_match_all('/\<img id="strip([0-9]+)" src="http:\/\/www.hs.fi\/kuvat\/iso_webkuva\/([0-9]+).jpeg" align="center" border="0" alt="" title=""\>/', $p, $m); | |
$img = $m[0][0]; | |
if( empty($img) ) { | |
preg_match_all('/\<img id="strip([0-9]+)" src="http:\/\/www.hs.fi\/kuvat\/iso_webkuva\/([0-9]+).gif" align="center" border="0" alt="" title=""\>/', $p, $m); | |
$img = $m[0][0]; | |
} | |
//print_r($img); | |
if( !empty($img) ) { | |
$subject = 'Fingerpori: '.date("Y-m-d"); | |
$message = '<html><head><title>'.$subject.'</title></head><body>'.$img.'</body></html>'; | |
$to = "Your Email <[email protected]>"; | |
// To send HTML mail, the Content-type header must be set | |
$headers = 'MIME-Version: 1.0' . "\r\n"; | |
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; | |
// $headers .= 'To: '. $to . "\r\n"; | |
$headers .= 'From: Fingerpori Express <[email protected]>' . "\r\n"; | |
// Mail it | |
mail($to, $subject, $message, $headers); | |
} else { | |
print_r($m); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment