Advertisement
Guest User

Untitled

a guest
Nov 2nd, 2016
217
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.82 KB | None | 0 0
  1. CURL *curl;
  2. CURLcode res;
  3. std::string readBuffer;
  4.  
  5. char username[] = "Username=Admin&Password=12781278";
  6.  
  7. curl_global_init(CURL_GLOBAL_ALL);
  8.  
  9. /* get a curl handle */
  10. curl = curl_easy_init();
  11.  
  12. if(curl) {
  13.  
  14. curl_easy_setopt(curl, CURLOPT_URL, "http://www.mywebsite.com/app/Test.php");
  15. curl_easy_setopt(curl, CURLOPT_POSTFIELDS, username);
  16. curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, WriteCallback);
  17. curl_easy_setopt(curl, CURLOPT_WRITEDATA, &readBuffer);
  18. res = curl_easy_perform(curl);
  19.  
  20. // Check for errors
  21. if (res != CURLE_OK)
  22. fprintf(stderr, "curl_easy_perform() failed: %sn",
  23. curl_easy_strerror(res));
  24.  
  25. //always cleanup
  26. curl_easy_cleanup(curl);
  27.  
  28.  
  29. }
  30. curl_global_cleanup();
  31. return 0;
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement