develooper Front page | perl.libwww | Postings from March 2003

Re: POST to page returns another page (to POST to)

Thread Previous
From:
John J Lee
Date:
March 14, 2003 06:38
Subject:
Re: POST to page returns another page (to POST to)
Message ID:
Pine.LNX.4.44.0303141430420.804-100000@alice
On Thu, 13 Mar 2003, lyle hayhurst wrote:

> Hello!  I am using LWP to post to a web page.  The
> post works fine, but the $response the comes back
> contains the HTML of _another_ page that I have to
> POST to.
>
> This is where I get stuck.
>
> Normally when I  $agent->request( POST $url [...] ) I
> know the $url.  In this case I don't have a url -- I
> have a $response with some html inside of it.  How do
> I POST to this new page?  (I tried using HTML::Form as
> well, using the HTML::Form->parse( $content, $uri )
> mechanism, but this simply posted to the original page
> I POST'ed to).
[...]

I'm sure LWP will do this redirect for you if you ask it right, but:

a) IIRC all POSTs are redirected as GET, not POST.

b) To get the url, look in the Location header (unless this redirect is
done with a Refresh header (which may be in a META HTTP-EQUIV tag in the
HTML, but IIRC LWP will add it to the headers automatically).


John


Thread Previous


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About