Scripts (both in Java and Perl) to automate online status inquiry

Try using LWP::Simple package. So you may not need external spidering code.

If you guys want it, I can develop the code for you. But I need a dummy SRC#. (Leave message in immigration forum.)

johnjohn said:
Dear king1999, bkd52,
Thank you very much. I am not Perl programer. I never use Perl before. Would you please help me to setup the perl to run this scripts?
the following is what I did, but it doesnot work.
My computer runs Windows2000.
in windows200, have C,D,E,F 4 Hard Drives
1. I donwload the curl-7.11.0-win32-ssl.zip, unziped it to c:\curl\ming32
2. download perl to f:\perl
create all the folders on my hard Drivs needed in the following scripts:
$status_file = "F:\\BICS_status.html";
$old_status_file = "F:\\BICS_status.";
$curl = "C:\\cURL\\ming32\\curl.exe";
$logfile = "F:\\SysTools\\scripts\\485check.log";
$history = 'F:\\SysTools\\scripts\\history';

I copy the Scripts to f:\scripts folder,
go to start-run-(type cmd)
type F:
cd\scripts:
F:\scripts>perl inquire_bics.pl
got the following error message:

The dynamic link library libeay32.dll could not be found in the specied path c:\cur\ming32, c:\winnt\system32;c:\winnt\system;c:\winnt;c:\winnt\system32\wbem;
c:\program files\ActiveState Komodo 2.5\


What should I do?
I only wnat to run this script to check on line status. If you can post step by step how to download the software need, how to install, how to create the directory and how to run the
script, it would be wonderful, I know some people is not IT field, but what to setup and run the scripts.

Thank you
 
CODE
===============
#!/usr/bin/perl

########## USER CONFIGURATION START ##################

# ISP Info
$from = 'yourname@email.com';
$to = 'yourname@email.com';
$smtp = 'smtp.bellsouth.com';

# Application Ids - Seperate multiple Application Ids by spaces
@apps = qw(SRC1212121212 SRC23232323232);

########## USER CONFIGURATION END #####################
use LWP::UserAgent;

foreach (@apps) {

my $message = get_status($_);
if($message ne "") {
if(check_lastupdate($_,$message)) {
send_mail($message);
}
} else {
send_mail("<h3>Page Regex have changed! Update Regex</h3>");
}
}

sub get_status
{
my $gov_url = 'https://egov.immigration.gov/cris/caseStatusSearch.do?appReceiptNum=';

my $page = "";

my $ua = LWP::UserAgent->new(env_proxy => 1,
keep_alive => 1,
timeout => 30,
);
$ua->agent('Mozilla/7.0');
$ua->cookie_jar({ file => "cookies.txt" });

my $response = $ua->get("$gov_url$_[0]");
my $page = $response->content;

return $1 if($page =~ m/(Receipt Number.*?)<\/td>/si);
return "";
}

sub check_lastupdate
{
my $appid = shift;

my $status_file = "mystatus$appid.txt";
my $hash_value = "0";

if(-f $status_file) {
open STATUS,"$status_file" or
send_mail("<h3>Permission Error! Unable to open $status_file</h3>");
$hash_value = <STATUS>;
close STATUS;
}

use Digest::MD5 qw(md5_hex);

open STATUS,">$status_file" or
send_mail("<h3>Permission Error! Unable to write to $status_file</h3>");
print STATUS md5_hex(@_);
close STATUS;

my $new_val = md5_hex(@_);
return 1 if($new_val ne $hash_value);

return 0;
}

sub send_mail
{
use Net::SMTP;

my ($msg) = @_;

my $smtp = Net::SMTP->new($smtp);

$smtp->mail($from);
$smtp->to($to);

$smtp->data();
$smtp->datasend("Content-Type: text/html\n");
$smtp->datasend("From: $from\n");
$smtp->datasend("To: $to\n");
$smtp->datasend("Subject: STATUS UPDATE\n\n");
$smtp->datasend("$msg");
$smtp->dataend();

$smtp->quit;
}
===================
 
Top