#This is not a CGI. # #Allows you to send a text message through Verizon's website or check on the #status of a previously sent message with a given number and message id. # #Works very well with procmail and/or cron etc. # #srour@cs.wisc.edu Sat Jun 15 03:41:32 CDT 2002 # use HTTP::Request::Common qw(POST); use LWP::UserAgent; use Getopt::Std; my %opts = (); if((scalar @ARGV) == 0){ usage(); } $ua = LWP::UserAgent->new; #Lets attempt to not piss off Verizon, shall we? $ua->agent("Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0 " . $ua->agent); getopts('n:m:f:t:',\%opts); #Check to see if we are tracking or sending. if(defined($opts{'t'}) && defined($opts{'n'})){ track(); } else{ my $charCount = 0; $charCount += length $opts{'f'}; $charCount += length $opts{'m'}; $charCountNew = 160 - $charCount; if($charCountNew < 0){ print "You are using $charCount characters when the maximum allowed is 160!\n"; exit 0; } send_message(); } exit 0; sub track{ $post_action_url = 'http://www.vtext.com/status_by_input.jsp'; my $req = POST $post_action_url, [ 'msgid' => $opts{'t'}, 'destField' => $opts{'n'}]; my $status_html = $ua->request($req)->as_string; $status_html =~ /size=\"1\"\>([A-Za-z ]*)\<\/font\>.*\>(\d{1,2}\/\d{1,2}\/\d{4}\s+\d{1,2}:\d{2}\s+am|pm).*/s; $message_status = $1; $arrival_time = $2; if(($message_status || $arrival_time) eq ''){ print "An error occured while parsing Verizon's website or you entered\n"; print "an incorrect Message ID and Recipient number. If your data is\n"; print "correct then my regex needs updating.\n"; } else{ print "Message information\n"; print "ID: $opts{'t'}\t\t\tRecipient: $opts{'n'}\t\n"; print "Status: $message_status\tDelivery time: $arrival_time\n"; } } sub send_message{ my $req = POST 'http://www.vtext.com/results.jsp', [ 'min' => $opts{'n'}, 'subject' => $opts{'f'}, 'message' => $opts{'m'}, 'Send.x' => 'Yes', 'TCS_MSG_TRACKING_IDS' => '', 'showgroup' => 'n', 'SRCADDR' => '', 'mins' => '', 'trackResponses' => 'No', 'senderName' => '', 'from' => '', 'priority' => 'normal', 'tCharacterCount' => $charCountNew]; my $status_html = $ua->request($req)->as_string; #This is the response html that we get back from them, this will totally fuck up #WHEN they change the composition of the html. This was working on Sat Jun 15 01:24:36 CDT 2002 $status_html =~ /(MsgID.{10}).*td.*td\>(\d{10})\s*\<\/td\>\s*\