diff options
author | Daniel Schauenberg <d@unwiredcouch.com> | 2016-01-16 23:04:46 -0500 |
---|---|---|
committer | Jay Satiro <raysatiro@yahoo.com> | 2016-01-16 23:05:07 -0500 |
commit | 1074cca8cd420eddf724e6e0b40e60e6a080ada1 (patch) | |
tree | eb84642ef16d0669bf501a84a5bcdc02e0a50692 | |
parent | be538e07667e1ba880b7201014be706851428d40 (diff) |
CURLINFO_RESPONSE_CODE.3: add example
-rw-r--r-- | docs/libcurl/opts/CURLINFO_RESPONSE_CODE.3 | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/docs/libcurl/opts/CURLINFO_RESPONSE_CODE.3 b/docs/libcurl/opts/CURLINFO_RESPONSE_CODE.3 index e06087239..60a12a9fb 100644 --- a/docs/libcurl/opts/CURLINFO_RESPONSE_CODE.3 +++ b/docs/libcurl/opts/CURLINFO_RESPONSE_CODE.3 @@ -38,7 +38,19 @@ Support for SMTP responses added in 7.25.0. .SH PROTOCOLS HTTP, FTP and SMTP .SH EXAMPLE -TODO +.nf +CURL *curl = curl_easy_init(); +if(curl) { + CURLcode res; + curl_easy_setopt(curl, CURLOPT_URL, "http://example.com"); + res = curl_easy_perform(curl); + if(res == CURLE_OK) { + long response_code; + curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &response_code); + } + curl_easy_cleanup(curl); +} +.fi .SH AVAILABILITY Added in 7.10.8. CURLINFO_HTTP_CODE was added in 7.4.1. .SH RETURN VALUE |