原程序如下:

原程序如下:

#!/usr/bin/perl

use Sybase::DBlib;
use Net::SMTP;
use Mail::Sender;
use HTTP::Lite;
use MIME::Base64;

#use HTTP::ProxySelector;
#use LWP::UserAgent;




my $counter=0;

while($counter
$http = new HTTP::Lite;
$http->proxy('proxy.***.com:8180');
$encoded = encode_base64('user1:user1password');
$http->add_req_header("Authorization", $encoded);


$req = $http->request("http://travel.state.gov/visa/frvi/bulletin/bulletin_1770.html")
or die "Unable to get document: $!";
my $content=$http->body();

if($content =~ /July 2006/){

print 'Yes';

my $sender = new Mail::Sender {smtp => 'mail.***.com', from => 'visalooker@***.com', auth => 'LOGIN',
authid => 'user1',authpwd => 'uuser1password',};
$sender->MailFile({to => 'xyz@***.com', subject => "July 2006 Visa is avaiable",
msg => " ",
file => 'message.txt'});

exit 0;

}

sleep 60;
$counter ++;

}



my $sender = new Mail::Sender {smtp => 'mail.***.com', from => 'visalooker@***.com', auth => 'LOGIN',
authid => 'user1',authpwd => 'uuser1password',};
$sender->MailFile({to => 'xyz@***.com', subject => "No July 2006 Visa is avaiable today",
msg => " ",
file => 'message.txt'});


需幾點改進:

1。 Scan html line by line, once it finds July 2006, then grep href, then HTTP this new href, then send email to users


  • June 2006


  • 2. send an email without a message.txt file

    3. 如無需 Proxy Server,則不必用$http->proxy('proxy.***.com:8180');


    所有跟帖: 

    不錯不錯,沒有太頻繁 -7o-o7- 給 7o-o7 發送悄悄話 (172 bytes) () 06/09/2006 postreply 11:07:47

    請您先登陸,再發跟帖!