summaryrefslogtreecommitdiff
path: root/docs/libcurl/curl_easy_getinfo.3
diff options
context:
space:
mode:
Diffstat (limited to 'docs/libcurl/curl_easy_getinfo.3')
-rw-r--r--docs/libcurl/curl_easy_getinfo.322
1 files changed, 22 insertions, 0 deletions
diff --git a/docs/libcurl/curl_easy_getinfo.3 b/docs/libcurl/curl_easy_getinfo.3
index 845e303e3..70be8a238 100644
--- a/docs/libcurl/curl_easy_getinfo.3
+++ b/docs/libcurl/curl_easy_getinfo.3
@@ -282,6 +282,28 @@ Total time of the previous request.
The time it took for all redirection steps
include name lookup, connect, pretransfer and transfer before final
transaction was started. So, this is zero if no redirection took place.
+.SH EXAMPLE
+.nf
+ curl = curl_easy_init();
+ if(curl) {
+ curl_easy_setopt(curl, CURLOPT_URL, "https://www.example.com/");
+ res = curl_easy_perform(curl);
+
+ if(CURLE_OK == res) {
+ char *ct;
+ /* ask for the content-type */
+ res = curl_easy_getinfo(curl, CURLINFO_CONTENT_TYPE, &ct);
+
+ if((CURLE_OK == res) && ct)
+ printf("We received Content-Type: %s\n", ct);
+ }
+
+ /* always cleanup */
+ curl_easy_cleanup(curl);
+ }
+.fi
+.SH AVAILABILITY
+Added in libcurl 7.4.1
.SH RETURN VALUE
If the operation was successful, CURLE_OK is returned. Otherwise an
appropriate error code will be returned.