Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling

ASP, and HTTP::Request POST

by kb2yht (Acolyte)
on May 29, 2001 at 03:05 UTC ( #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(''); $forms_agent->timeout(62); my $cjar = HTTP::Cookies->new(); my $content = "SNumber=$_[0]\nDataAction=Submit"; my $saf_url = URI::URL->new(); $saf_url->base(""); $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

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.
    should fix the problem.
      IIRC it is in fact automagically done for you, altho not with all types of media data.

      ... Quidquid perl dictum sit, altum viditur.

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (1)
As of 2023-10-01 14:27 GMT
Find Nodes?
    Voting Booth?

    No recent polls found