cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: Handling multiple redirects to various CGI scripts

From: Ralph Mitchell <ralphmitchell_at_gmail.com>
Date: Fri, 21 Jan 2005 22:08:35 -0600

Second that. You need to check out the page that you get and look for:

   o META REFRESH tags that tell a browser to go elsewhere

   o javascript that does "location.href=[some new url]"

I had a problem once with a page that assembled a new url in
javascript based on form entry values, then "magically" transported
the browser to that page using "location.href=xxxx". In comparison,
meta refresh tags are child's play... :)

Ralph Mitchell

On Fri, 21 Jan 2005 16:46:27 -0500, HART, CHRISTOPHER T
<christopher.t.hart_at_bankofamerica.com> wrote:
> It might be that those subsequent redirects are handled through client-side scripting. The -L option only follows redirects that are issued as an HTTP 302 header redirect. If it is a client-side script, usually you can just write your script so that it makes the first request (using the -b and -c options to capture and provide any cookies you pick along the way), then make the subsequent requests using the same cookie file. (cURL won't handle or interpret VB/Java/ECMA-script; it's up to you to implement that manually.)
>
> Chris Hart
>
> -----Original Message-----
> From: curl-users-bounces_at_cool.haxx.se
> [mailto:curl-users-bounces_at_cool.haxx.se]On Behalf Of E. Mark Floyd II
> Sent: Friday, January 21, 2005 4:30 PM
> To: curl-users_at_cool.haxx.se
> Subject: Handling multiple redirects to various CGI scripts
>
> I wanted to know how to handle a multiple redirect using Curl, if it is
> possible (the documentation vaguely says it's possible). Here is the
> scenario we're trying to solve:
>
> "Use curl to script a login. The login is comprised of three parts.
> The initial curl call to login.cgi, which needs to be followed by
> subsequent cgi scripts which need to all happen in order to complete the
> login."
>
> I am currently using the -L option to handle unlimited number of
> redirects, but it always stops after login.cgi, the redirect at the 2nd
> step doesn't happen.
>
> Can someone please help shed some light on implementing this in Curl.
>
> Regards,
>
> Mark
>
> --
> To be conscious that you are ignorant is a great step to knowledge.
> Benjamin Disraeli (1804 - 1881), Sybil, 1845
>
>
Received on 2005-01-22