cURL / Mailing Lists / curl-library / Single Mail

curl-library

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

From: Basil Su <hityourface_at_gmail.com>
Date: Wed, 7 Apr 2010 21:44:53 +0800

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.

2010/4/7 Kamil Dudka <kdudka_at_redhat.com>

> On Wed April 7 2010 12:12:56 Basil Su wrote:
> > HI ALL,
> > i use libcurl to develop a simple http client. now i can download
> > normally. but i've got a problem. if the server returns 302, how can i
> > know? i mean, i only know like this:
> > CURLMsg *msg = curl_multi_info_read(), and i could use
> msg->data.result
> > know whether this connection is OK, but if 302? could i know? or i should
> > parse the download data libcurl gives me?
>
> I guess you're looking for CURLINFO_RESPONSE_CODE:
>
> http://curl.haxx.se/libcurl/c/curl_easy_getinfo.html#CURLINFORESPONSECODE
>
> Kamil
>

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