cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: how to know http server returns 302 and deal with it?

From: Aleksandar Lazic <al-curllibrary_at_none.at>
Date: Sat, 27 Feb 2010 10:20:19 +0100

Dear Basil,

On Sam 27.02.2010 15:59, Basil Su wrote:
>help:
>i'm programming for fun using libcurl 7.19.5 in Linux/C. i'm confused
>that if the http server returns 302, can i get it according
>curl_easy_getinfo() ?
>is the error code 0 or something else?
> thanks.

you can adopt the following example with CURLINFO_RESPONSE_CODE

http://curl.haxx.se/libcurl/c/getinfo.html

on http://curl.haxx.se/libcurl/c/curl_easy_getinfo.html is this
information described as following.

###
CURLINFO_RESPONSE_CODE

Pass a pointer to a long to receive the last received HTTP or FTP
code. This option was known as CURLINFO_HTTP_CODE in libcurl 7.10.7 and
earlier. This will be zero if no server response code has been
received. Note that a proxy's CONNECT response should be read with
CURLINFO_HTTP_CONNECTCODE and not this.
###

Hth

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