Hello fellow Monks,

USPS.com recently made a change to their Zip Lookup program. I tried to automate a query with the following script:

#!/opt/gnu-irix/bin/perl use strict; use HTTP::Request::Common qw(POST); use LWP::UserAgent; my $ua = new LWP::UserAgent; my $url = 'http://www.usps.com/zip4/zip4_response.jsp'; my $data = [ 'Selection' => '1', 'address1' => $ARGV[0], 'address2' => '', 'city' => '', 'state' => '', 'zipcode' => $ARGV[1], 'Submit' => '' ]; $ua = new LWP::UserAgent; my $resp = $ua->request(POST $url, $data); if ($resp->is_success()) { print $resp->content(); } else { print "OOPS\n", $resp->as_string(); }

At the command prompt, I typed:

address.pl '1713 62nd Avenue' '20785'

And got this response:

OOPS HTTP/1.1 500 (Internal Server Error) Server Error Connection: close Date: Fri, 16 Aug 2002 15:20:52 GMT Server: Netscape-Enterprise/6.0 Content-Length: 305 Content-Type: text/html Client-Date: Fri, 16 Aug 2002 15:20:45 GMT Client-Peer: 56.0.78.66:80 Title: Server Error <HTML><HEAD><TITLE>Server Error</TITLE></HEAD> <BODY><H1>Server Error</H1> This server has encountered an internal error which prevents it from f +ulfilling your request. The most likely cause is a misconfiguration. Please ask the administrator to look for messages in the server's error log. </BODY></HTML>

I urgently need an explanation for this. My initial thought is that LWP cannot interface with Java servlets (.jsp does indicate a java servlet, right?). Your feedback is greatly needed and appreciated.


In reply to PLEASE ADVISE: Has USPS banned LWP??? by Shizzle

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.