cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Help: getting the current url

From: Ralph Mitchell <ralphmitchell_at_gmail.com>
Date: Thu, 10 Apr 2008 16:42:29 -0500

On Thu, Apr 10, 2008 at 4:22 PM, Am Ro <skyelabs_at_gmail.com> wrote:

>
> That was a typo in my message. I used curl_easy_getinfo, but it prints
> "\270", instead of the value of currentURL.
>
> New Code:
>
> int connect (const char* aURL)
> {
> char *currentURL;
> CURL *urlHandler;
> curl_easy_setopt(urlHandle, CURLOPT_URL, aURL);
> curl_easy_perform(urlHandle);
> curl_easy_getinfo(urlHandle, CURLINFO_EFFECTIVE_URL, currentURL);
> printf ((const char*)currentURL);
> }
>

You're declaring CURL *urlHandler and not using it, which doesn't really
matter if urlHandle is declared outside the function and inited using
curl_easy_init. Another typo??

Ralph Mitchell
Received on 2008-04-10