|07-11-2005, 02:24 AM||#1|
this little Perl script grabs the WOD from the CrossFit main page and sends it to you by email via SMTP.
All you need to do is to copy and paste the text between the CDATA section markers below into a file named get-wod.pl, save the script to some folder, edit the username for to/from (do not delete the \ before the @ sign!) and the server name, and create a new task to run at the desired time that executes the script. Voila, WOD per email. (You obviously need to have Perl installed on your computer for this to work, but I won't go into detail on that here.)
my $d = strftime qq(%y%m%d), localtime;
my $s = "";
($s = $1.qq(\n).$2) =~ s/<[^>]*>//g if get(qq(http://www.crossfit.com/)) =~ /($d)(.*?)<img/smi;
my $text = fill(q(),q(), $s);
my $mail = "user\@mydomain.com";
my $smtp = Net::SMTP->new('mail.mydomain.com');
$smtp->datasend("To: $mail\nSubject: WOD - $d\n");
|07-11-2005, 11:29 PM||#8|
if i can check my e-mail i can look at the WOD.
Hey, Tanner! Practical application: have the script send it to your cell phone so you get it when you are away from the computer!
Chuck, an exe would be AWESOME. I love me some computer geeks with muscles! :biggrin:
|07-12-2005, 12:46 AM||#9|
No, of course I don't mind at all. Do with it whatever you want, it was the result of some spare minutes when I was bored. Obviously you will have to put the username and server into some property file or such (maybe question for it on first use and store it?). The main insight in the code is that to grab the WOD, you want the part between the short ISO date of today and the opening tag of the image below the text. That's all.
|Thread||Thread Starter||Forum||Replies||Last Post|
|From a Spam Email "Only in America"||Paul Findley||Community||1||05-06-2006 10:52 AM|
|Funny email from one of my clients...||Michael Latch||Community||5||04-04-2006 04:38 PM|
|Got any Qs about KBs and/or CrossFit? Please email||Tom Corrigan||Community||0||07-26-2005 08:00 PM|