Originally posted by poongunranar
Friend, I wrote this program and have been using this for a loooooong time now. If you want some jazzy emailing stuff, etc., all you need is to invoke one of the Email modules of Perl (Net::SMTP, Mail::Sender, etc.)
Try this code, friend. It works like a charm.
#Author: 'Poongunranar'
#From Command-line invoke this program with a SINGLE command-line argument, viz. your SRC number without any dashes
#Example: perl <scriptname> SRC0122244444
use strict;
use WWW::Mechanize;
use HTTP::Cookies;
use HTML::TokeParser;
my($array) = [];
my $agent = WWW::Mechanize->new();
$agent->cookie_jar(HTTP::Cookies->new);
$agent->get("https://egov.immigration.gov/graphics/cris/jsps/caseStat.jsp");
$agent->form(1);
$agent->field("appReceiptNum", "$ARGV[0]");
$agent->click();
my($stream) = HTML::TokeParser->new(\$agent->{content});
#my($stream) = HTML::TokeParser->new("C:/bcis.htm");
$stream->get_tag("table") for(1..5);
$stream->get_tag("tr");
my $td = $stream->get_tag("td");
print $stream->get_trimmed_text("/b"),"\n"; #Case #
$stream->get_tag("p");
print $stream->get_trimmed_text("/b"),"\n"; #App Type
$stream->get_tag("p");
print $stream->get_trimmed_text("/b"); #Current Status
$stream->get_tag("p");
print $stream->get_trimmed_text("/p"),"\n\n\n"; #Actual Status