Advertisement
Guest User

Untitled

a guest
Oct 19th, 2017
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include "curl/curl.h"
  4. #include "json-c/json.h"
  5.  
  6. void initget();
  7.  
  8. int main()
  9. {
  10. nb = filters();
  11. constructfilters(nb)
  12. initget(url);
  13.  
  14. return 0;
  15. }
  16.  
  17. void initget () {
  18. CURL curl;
  19. CURLcode res;
  20.  
  21. curl = curl_easy_init();
  22. if(curl) {
  23. curl_easy_setopt(curl, CURLOPT_URL, "http://api.pokemontcg.io/v1/cards%22);
  24. / example.com is redirected, so we tell libcurl to follow redirection /
  25. curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);
  26.  
  27. / Perform the request, res will get the return code /
  28. res = curl_easy_perform(curl);
  29. / Check for errors /
  30. if(res != CURLE_OK)
  31. fprintf(stderr, "curl_easy_perform() failed: %s\n",
  32. curl_easy_strerror(res));
  33.  
  34. / always cleanup */
  35. curl_easy_cleanup(curl);
  36. }
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement