in reply to Re: POST with LWP yields HTTP 302 Not Allowed - Too bad for me?
in thread POST with LWP yields HTTP 302 Not Allowed - Too bad for me?

While talking to my sys admin, it dawned on me that our firewall had not authenticated me from the account where the perl scripts were written. See, when I was trying to figure out why I could use my browser and not LWP, I was surfing with IE on my local PC. So, from the Unix account where my perl scripts were, I fired up Netscape and typed www.usps.com. I supplied the firewall with my username and password, ran the perl script again, and got the desired results. Thanks to everyone for your feedback.
  • Comment on Re: Re: POST with LWP yields HTTP 302 Not Allowed - Too bad for me?

Replies are listed 'Best First'.
Re^3: POST with LWP yields HTTP 302 Not Allowed - Too bad for me?
by perlNinny (Beadle) on Mar 17, 2010 at 18:29 UTC
    It seems now the Post office doesn't let this work anymore:

    HTTP/1.1 405 Method Not Allowed
    Connection: close
    Date: Wed, 17 Mar 2010 18:07:28 GMT
    Server: Netscape-Enterprise/6.0
    Vary: Accept-Encoding
    Allow: HEAD, GET
    Content-Length: 124
    Content-Type: text/html
    Client-Date: Wed, 17 Mar 2010 18:07:27 GMT
    Client-Peer: 96.16.57.188:80
    Client-Response-Num: 1
    Title: Method Not Allowed

      Try setting the "user agent" string in LWP to something else.

      eg:

      use LWP::UserAgent; use HTTP::Request::Common; my $ua = LWP::UserAgent->new(); $ua->agent( "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1)" ); my $request = POST "http://the.url/the.page", { foo => 'bar', baz => 'bux', }; my $result = $ua->request( $request ); print $result->as_string;