hilltop,
"..can it be done grab output instead of displaying the html if so please give me an example 1100 points for this one plus an A+ rating .."
yes it can. here is a sample script that "submits" a form to that site and get the values and extracts only the Net Charge.
i have hard-coded the values for now, but they can easily be made dynamic.
to test some values yourself modify line 22 and add a different from and to zip code (95129 & 08817) or change the weight (12).
let me know how it goes.
#!/usr/local/bin/perl
require LWP;
require URI::URL;
use strict;
use CGI;
my($hdr,$server_response);
my($statement_URL)="http://www.af.com/ratetestcan.asp";
#my($query)=new CGI;
## Use the following lines (18-21) when you are calling this program
## via YOUR HTML form.
#foreach($query->param()){
# $hdr.=$_."=".$query->param($_)."&"; ## Join the CGI params using & delimiter
#}
#$hdr=~ s/(.*)&$/$1/; ## Remove the trailing &
## Right now the values are hard-coded
$hdr='as_shzip=95129&as_shcntry=US&as_cnzip=08817&as_cncntry=US&as_discpct=&as_class1=100&as_weight1=12&as_pkupdt=12/22/99';
$server_response=&browse($statement_URL,$hdr); ## Fire the URL
$server_response=~ /(\*\*Net Charge.*\n.*\n)/;
print "Content-type: text/html\n\n";
#print "$server_response";
print "Net Charge is $1";
sub browse(){
my($statement_URL,$hdr)=@_;
my($content_type,$method);
$content_type="application/x-www-form-urlencoded";
$method="POST";
my($headers)= new HTTP::Headers
'Content-Type' => $content_type,
'MIME-Version' => '1.0',
'Date' => HTTP::Date::time2str(time),
'Accept' => 'text/html';
my($ua)= new LWP::UserAgent;
$ua->agent("Mozilla/4.7 [en] (WinNT; U)"); # Define env variable - HTTP_USER_AGENT
my($url)= new URI::URL($statement_URL);
my($request)= new HTTP::Request($method, $url, $headers,$hdr);
my($response)= $ua->request($request);
my($reply);
if ($response->is_success){
$reply=$response->content;
}else{
$reply=$response->error_as_HTML();
}
return $reply;
}