How to use libcurl for HTTP message?

I am using libcurl. I do not understand how to use it for HTTP POST requests and how to check the result. How can I use it for this?

+7
source share
2 answers

See the manual page for documentation on the -d option. You can use this several times to transfer different key pairs, values ​​to the server. After that, use the --libcurl flag to see how it will look if you try to use libcurl to manually do this in your application.

+8
source
 #include <curl/curl.h> main() { CURL *curl; curl_global_init(CURL_GLOBAL_ALL); curl = curl_easy_init(); curl_easy_setopt(curl, CURLOPT_VERBOSE, 1); curl_easy_setopt(curl, CURLOPT_URL, "http://www.example.com/hello-world"); curl_easy_setopt(curl, CURLOPT_POST, 1); curl_easy_setopt(curl, CURLOPT_POSTFIELDS, "foo=bar&foz=baz"); curl_easy_perform(curl); curl_easy_cleanup(curl); } 
+12
source

All Articles