#include <stdio.h> #include <curl/curl.h> int main(void) { CURL *curl; CURLcode res; curl = curl_easy_init(); if(curl) { curl_easy_setopt(curl, CURLOPT_URL, "http://postit.example.com/moo.cgi"); curl_easy_setopt(curl, CURLOPT_POSTFIELDS, "name=daniel&project=curl"); res = curl_easy_perform(curl); curl_easy_cleanup(curl); } return 0; }
#include <string> ... string email="test@mail.ru"; string pass="password"; ... curl_easy_setopt(curl, CURLOPT_POSTFIELDS, "email="+email+"&pass="+pass); ...