cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: How to POST to the last redirect page

From: Bin Chen <binary.chen_at_gmail.com>
Date: Sat, 9 Jun 2007 07:02:17 +0800

Thanks for your reply, but a little confuse for me. The process should
be that, I input a URL to the AP and it returns a HTTP REDIRECT
message, curl can get this redirect URL and try to POST to it. How
does this make relation to cookie? I think I can make a shell script
to do curl twice, first to get the redirect address, second to POST to
it. Because I know it is only one redirect will be issued, so the
script should be simple.

I ask here is because maybe there is a direct and simple way for curl
to do this, not necessary to use script.

On 6/9/07, Dan Fandrich <dan_at_coneharvesters.com> wrote:
> 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-09