Advertisement
Guest User

HTTP request C

a guest
Jan 18th, 2013
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.46 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <curl/curl.h>
  3.  
  4. int main(void)
  5. {
  6. CURL *curl;
  7. CURLcode res;
  8.  
  9. curl = curl_easy_init();
  10. if(curl) {
  11. curl_easy_setopt(curl, CURLOPT_URL, "http://ya.ru");
  12.  
  13. /* Perform the request, res will get the return code */
  14. res = curl_easy_perform(curl);
  15. /* Check for errors */
  16. if(res != CURLE_OK)
  17. fprintf(stderr, "curl_easy_perform() failed: %s\n",
  18. curl_easy_strerror(res));
  19.  
  20. /* always cleanup */
  21. curl_easy_cleanup(curl);
  22. }
  23. return 0;
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement