Re: POSTing to a form and getting the results

Colin Reid (Colin@predictivedialers.com)
Wed, 1 Apr 1998 15:49:23 -0800


This is a multi-part message in MIME format.

------=_NextPart_000_0069_01BD5D85.BE4D1C40
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Well, after getting help from a couple of people (thank you!), I'm still =
running into problems trying to use POST.  I always get my manufactured =
error message.  What am I doing wrong?  CAUTION:  Code ahead!

--  Colin Reid
    colin@predictivedialers.com

use LWP::UserAgent;

$url =3D 'http://zip4.usps.gov/cgi-bin/zip4/zip4inq';

$street =3D '1440 SW 158th St';

$city =3D 'Seattle';

$state =3D 'WA';

use HTTP::Request::Common;

$ua =3D LWP::UserAgent->new;

my $res =3D $ua->request(POST $url,=20

[

street =3D> $street,

city =3D> $city,

state =3D> $state,

]);

$street =3D '1440 SW 158th St';

$city =3D 'Seattle';

$state =3D 'WA';

if ($res->is_success){

print $res->content;

} else {

print "Could not post to ",$url,"\n";

}




------=_NextPart_000_0069_01BD5D85.BE4D1C40
Content-Type: text/html;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD W3 HTML//EN">
Well, after getting help from a couple of people (thank you!), I'm = still=20 running into problems trying to use POST.  I always get my = manufactured=20 error message.  What am I doing wrong?  CAUTION:  Code=20 ahead!

--  Colin Reid
    colin@predictivedialers.com
 

use LWP::UserAgent;

$url =3D 'http://zip4.usps.gov/cgi-bin/zip4/zip4inq';

$street =3D '1440 SW 158th St';

$city =3D 'Seattle';

$state =3D 'WA';

use HTTP::Request::Common;

$ua =3D LWP::UserAgent->new;

my $res =3D $ua->request(POST $url,

[

street =3D> $street,

city =3D> $city,

state =3D> $state,

]);

$street =3D '1440 SW 158th St';

$city =3D 'Seattle';

$state =3D 'WA';

if ($res->is_success){

print $res->content;

} else {

print "Could not post to ",$url,"\n";

}

 

------=_NextPart_000_0069_01BD5D85.BE4D1C40--