[ic] LWP::UserAgent

Gert van der Spoel gert at 3edge.com
Thu Mar 10 16:54:23 UTC 2011


> Hello,
>
> I created my own usertag like your ups shipping tags for use in AU.
>
> This section retrieves the shipping charge from Australia Post based on
> weights and postcodes:
>
> my $return;
> my $error="OK";
> my $content;
> my
$url="http://drc.edeliver.com.au/rateCalc.asp?Height=$height&Length=$length&
Weight=$weight&Width=$width&Pickup_Postcode=$origin&Destination_Postcode=$zi
p&Country=$country&Service_Type=$modex&Quantity=1";
> use LWP::UserAgent;
> my $ua = LWP::UserAgent->new;
> $ua->timeout(5);
> $ua->env_proxy;
> my $aus_post=0;
> my $response =$ua->get("$url");
>
> if ($response->is_success)
> {
> $content = $response->content;
> }
> else
> {
> $aus_post=1;
> }
>
>
> $content used to return Australia post's web page which looks like this:
>
>
http://drc.edeliver.com.au/rateCalc.asp?Height=420&Length=210&Weight=100&Wid
th=460&Pickup_Postcode=6076&Destination_Postcode=298128&Country=KE&Service_T
ype=AIR&Quantity=1
>
> But now it returns "".
>
> What could blocking my code form the internet?

Does it not return an error? Tried checking: $response->status_line to see
what value it has?

CU,

Gert




More information about the interchange-users mailing list