cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: Simple Redirection Problem

From: Dan Fandrich <dan_at_coneharvesters.com>
Date: Mon, 29 Sep 2008 10:45:45 -0700

On Mon, Sep 29, 2008 at 07:18:43PM +0200, Michel Barakat wrote:
> I'm using the libcurl for C++, and I am facing a small problem.
> I'm trying to fetch a page (the first page) which redirects to the
> another page (the second page).
> The problem is that I'm reaching the first page instead of the second page.
>
> The following is set:
> curl_easy_setopt(curlHandle, CURLOPT_FOLLOWLOCATION, 1);
>
> I've tried the following without success:
> curl_easy_setopt(curlHandle, CURLOPT_AUTOREFERER, 1);
> curl_easy_setopt(curlHandle, CURLOPT_REFERER, ";auto");
>
> >From the command line, I was able to get the second page by doing:
> curl -e ";auto" <page_to_fetch>
>
> I can't figure out though what's the equivalent of -e ";auto" in libcurl.
> Any thoughts?

";auto" in the command line is translated into the CURLOPT_AUTOREFERER, so
you shouldn't need to do anything more. Just remove the CURLOPT_REFERER
option altogether. Note that those integers should be longs, so pass in "1L"
instead of just "1".

>>> Dan

-- 
http://www.MoveAnnouncer.com              The web change of address service
          Let webmasters know that your web site has moved
-------------------------------------------------------------------
List admin: http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-users
FAQ:        http://curl.haxx.se/docs/faq.html
Etiquette:  http://curl.haxx.se/mail/etiquette.html
Received on 2008-09-29