cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: How to POST to the last redirect page

From: Dan Fandrich <dan_at_coneharvesters.com>
Date: Fri, 8 Jun 2007 12:53:59 -0700

On Fri, Jun 08, 2007 at 11:11:44PM +0800, Bin Chen wrote:
> Suppose an Access point will redirect any URL request to a
> authentication address, that is when I input www.a.com then the AP
> will redirect it to www.auth.com/auth, where there is a form to fill
> in, then will do the authentication.
> How to write a curl script to achieve the authentication process, I
> know I can use post but the final URL can't be known.By the way, the
> authentication web page is identical but only the URL may differ.
> I know when curl do POST with redirect, it will only apply the POST to
> the first one. But in this case I need to POST to the last one.

The final URL *has* to be known for any browser to POST to it. You probably
just need to enable cookies and URL redirection to curl and have it do a
GET to the first URL to obtain the cookies, then a POST to post the data.
Take a look at http://curlm.haxx.se/docs/httpscripting.html

>>> Dan

-- 
http://www.MoveAnnouncer.com              The web change of address service
          Let webmasters know that your web site has moved
Received on 2007-06-08