Guys, I am using LWP to post information from a script on one machine to a script on another box.

However, I do not know how to test for errors. My goal is to find something in the HTTP response that will tell me if the request was successful or not. $response->as_string gives me this error message that I do not understand at all:

500 (Internal Server Error) unexpected EOF before status line seen Client-Date: Thu, 14 Nov 2002 16:10:08 GMT

HOWEVER, the script is successfully called, despite the 500 error message, which makes this case even more puzzling.

Here is my code:

# HTTPIZE! foreach $elem ( keys %tform ) { $tform{$elem} = &cgi'httpize($tform{$elem}); } $qs = "Firstname=$tform{firstname}%20$tform{lastname}&Company= +$tform{company}&WorkStreetAddress=$tform{addr1}&WorkCity=$tform{city} +&WorkProvince=$tform{state}&WorkCountry=$tform{country}&WorkZipCode=$ +tform{zip}&WorkPhone=$tform{phone}&txtAddEmail=$tform{email}&signUpGS +N=T"; my $ua = new LWP::UserAgent; $ua->credentials('www.SENDER.com','outer','proactive','gr8ap3' +); $header = new HTTP::Headers; $header->header(MIME_Version => '1.0', User_Agent => 'Viaduct Proactive/2.0', From => 'proactive\@viaduct.com'); $page = 'http://www.RECEIVER.com/nti/nti.pl?'; $request = new HTTP::Request 'POST',$page,$header,$qs; $response = $ua->request ($request); $action = $response->as_string; open (TEST, ">TEST.txt") || die "ARGH!\n\n"; # THIS LINE GENERATES THE 500 ERROR! print TEST "$action\n"; # AS A RESULT, I FAIL! BOO HOO! if ($response->is_redirect) { print TEST "SUCCESS\n"; } else { print TEST "FAILED\n"; } close (TEST);
Thanks, you guys have been great in the past! Robert

In reply to How do you find out if your HTTP response succeeded via LWP? by kleinbiker7

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.