Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

ASP, and HTTP::Request POST

by kb2yht (Acolyte)
on May 29, 2001 at 03:05 UTC ( [id://83800]=perlquestion: print w/replies, xml ) Need Help??

kb2yht has asked for the wisdom of the Perl Monks concerning the following question:

Humm.... I'me trying to get a responce from an NT box offering me a ASP based forms system, I've used LWP and HTTP::Request etc. in the past to do this from CGI based pages, perhapes there is knowlage with the greater monks on why this code will not give a correct responce.
The submission works , the form server genorates a answer that indicated I've submitted a blank form.
1. The form is asking for a POST method , However unless I send the request with URL encoded data I get no responce.
2. when I do send a request in a correct POST format, The form data is lost.
my $forms_agent = LWP::UserAgent->new(); $forms_agent->from('nolan@foo.bar'); $forms_agent->timeout(62); my $cjar = HTTP::Cookies->new(); my $content = "SNumber=$_[0]\nDataAction=Submit"; my $saf_url = URI::URL->new(); $saf_url->base("http://192.168.1.1/safety/"); $saf_url->path("UpdateAction.asp"); $saf_url->query("DataAction=Submit&SNumber=$_[0]"); my $head = HTTP::Headers->new( Accept=>'text/html' ); $head->referer('UpdateForm.asp'); $head->date(time); my $saf_request = HTTP::Request->new(POST=>$saf_url,$head,$con +tent); my $answer = $forms_agent->request($saf_request); $cjar->extract_cookies($answer); $saf_url->path($answer->header("location")); $saf_url->query(''); $saf_request = HTTP::Request->new( POST=>$saf_url,$head); $cjar->add_cookie_header($saf_request); $answer = $forms_agent->request($saf_request);

Is there An Error in my code ??
Or Is this more likely an error in the servers ASP system.??
Thanks much ,
Bill Nolan
wnolan@bnl.gov

Replies are listed 'Best First'.
Re: ASP, and HTTP::Request POST
by nardo (Friar) on May 29, 2001 at 10:07 UTC
    You're not setting the content-length, I don't think this is automatically done for you.
    $head->content_length(length($content));
    should fix the problem.
      IIRC it is in fact automagically done for you, altho not with all types of media data.

      Greetz
      Beatnik
      ... Quidquid perl dictum sit, altum viditur.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://83800]
Approved by root
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others goofing around in the Monastery: (2)
As of 2024-04-26 03:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found