cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: CURLINFO_EFFECTIVE_URL

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Fri, 14 Feb 2003 11:05:04 +0100 (CET)

On Thu, 13 Feb 2003, Charles wrote:

> When i try to get the last used URL (does this include the URL that it
> was redirected too if redirect is turned on ? I am trying to get the
> list of URL's that are being visited in a series of redirects) but all
> I get is part of the header, including the referer along with some
> trash. Here is the code,

To quote the docs:

        Pass a pointer to a 'char *' to receive the last used effective URL.

It means you get the last URL libcurl tried to fetch. If you followed
locations, it is the last one libcurl followed to. Any suggestion on a
better, more explanatory description for the manual is welcome.

> char *url = new char[1000];
> curl_easy_getinfo(curl,CURLINFO_EFFECTIVE_URL,url);

This is wrong.

'url' above is not "a pointer to a 'char *'".

Try something like this:

        char *url = NULL;
        curl_easy_getinfo(curl, CURLINFO_EFFECTIVE_URL, &url);

-- 
 Daniel Stenberg -- curl, cURL, Curl, CURL. Groks URLs.
-------------------------------------------------------
This SF.NET email is sponsored by: FREE  SSL Guide from Thawte
are you planning your Web Server Security? Click here to get a FREE
Thawte SSL guide and find the answers to all your  SSL security issues.
http://ads.sourceforge.net/cgi-bin/redirect.pl?thaw0026en
Received on 2003-02-14