cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: curl redirect

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Wed, 26 Sep 2007 13:46:03 +0200 (CEST)

On Wed, 26 Sep 2007, ÔøÀ¤ wrote:

> In my program, I use the curl_easy_setopt function with the
> "CURLOPT_FOLLOWLOCATION" option set. When my progrm is redirected to another
> location, how can I get the Location part in the HTTP header?
>
> Should I set the CURLOPT_HEADERFUNCTION option, and parse the HTTP header to
> get the "Location" option? I think this method is not effective, want your
> suggestion!

I'd recommend CURLINFO_EFFECTIVE_URL:

http://curl.haxx.se/libcurl/c/curl_easy_getinfo.html#CURLINFOEFFECTIVEURL

-- 
  Commercial curl and libcurl Technical Support: http://haxx.se/curl.html
Received on 2007-09-26