cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: help -- how can i get the result when sever returns 302?

From: Kamil Dudka <kdudka_at_redhat.com>
Date: Wed, 7 Apr 2010 16:21:26 +0200

On Wed April 7 2010 15:44:53 Basil Su wrote:
> Kamil,
> hi,thanks for your help. i did want to look for CURLINFO_RESPONSE_CODE.
> but i've still got a problem. i give libcurl a url and i know the server
> would return 302 and a data including the new location. but libcurl still
> returns 200, and the data it gives me is the data including new location (
> the header).
> i use libcurl like this:
>
> curl_easy_setopt(_curl, CURLOPT_FOLLOWLOCATION, true);
>
> but it didn't seem to work out.

Are you sure there is no redirect?

Is there any proxy and/or authentication involved?

If libcurl returns 200, then it most likely means that server has returned
200. Use the CURLOPT_VERBOSE option to see what happens on the protocol
level:

http://curl.haxx.se/libcurl/c/curl_easy_setopt.html#CURLOPTVERBOSE

Kamil
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2010-04-07