#!/usr/local/bin/perl ############################################################ # UPS Hack using http-lib.pl by Rod Morris, October 21, 1999 # Based on David Boring and Etal Soames previous hacks # that didn't seem to like Windoze. # You must edit http-lib.pl for NT: # $http_os = "NT"; # http-lib.pl is available from Extropia.com # require './lib/http-lib.pl'; ############################################################ # Test variables # $upsAction = "3"; $upsProduct = "GND"; $OriginPostalCode = "92029"; $DestPostalCode = "07079"; $DestCountry = "US"; $PackageWeight = "2"; $Value="20"; # Use these for Dim weights, values in inches $length = '7'; $width = '24'; $height = '12'; # Build the request to UPS $versionInfo = "HTTP/1.0\n\n"; $workString = "?accept_UPS_license_agreement=yes"; $workString .= "&10_action=$upsAction"; $workString .= "&13_product=$upsProduct"; $workString .= "&15_origPostal=$OriginPostalCode"; $workString .= "&19_destPostal=$DestPostalCode"; $workString .= "&22_destCountry=$DestCountry"; $workString .= "&23_weight=$PackageWeight"; $workString .= "&24_value=$Value"; $workString .= "&25_length=$length"; $workString .= "&26_width=$width"; $workString .= "&27_height=$height"; $workString .= "47_rate_chart=Regular Daily Pickup"; $workString .= "49_residential=1"; $in = "$workString $versionInfo"; $host = "www.ups.com"; $url = "/using/services/rave/qcostcgi.cgi"; $port = 80; print STDOUT "Content-type: text/html\n\n"; print STDOUT "$in
\n\n"; # Actual call to get price $buf = &HTTPGet($url, $host, $port, $in); print STDOUT "$buf
\n\n";
@ups = split(/\%/,$buf);
# print out UPS header info
print STDOUT "Header: $ups[0]
\n";
# print out UPS shipping charge
print STDOUT "UPS charge: $ups[10]
\n";