persistant.c 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. /*****************************************************************************
  2. * _ _ ____ _
  3. * Project ___| | | | _ \| |
  4. * / __| | | | |_) | |
  5. * | (__| |_| | _ <| |___
  6. * \___|\___/|_| \_\_____|
  7. *
  8. * $Id$
  9. */
  10. #include <stdio.h>
  11. #include "curl/curl.h"
  12. /* to make this work under windows, use the win32-functions from the
  13. docs/examples/win32socket.c file as well */
  14. /* This example REQUIRES libcurl 7.7 or later */
  15. #if (LIBCURL_VERSION_NUM < 0x070700)
  16. #error Too old libcurl version, upgrade or stay away.
  17. #endif
  18. int main(int argc, char **argv)
  19. {
  20. CURL *curl;
  21. CURLcode res;
  22. #ifdef MALLOCDEBUG
  23. /* this sends all memory debug messages to a specified logfile */
  24. curl_memdebug("memdump");
  25. #endif
  26. curl_global_init(CURL_GLOBAL_DEFAULT);
  27. curl = curl_easy_init();
  28. if(curl) {
  29. curl_easy_setopt(curl, CURLOPT_VERBOSE, 1);
  30. curl_easy_setopt(curl, CURLOPT_HEADER, 1);
  31. /* get the first document */
  32. curl_easy_setopt(curl, CURLOPT_URL, "http://www.cmake.org/");
  33. res = curl_easy_perform(curl);
  34. /* get another document from the same server using the same
  35. connection */
  36. curl_easy_setopt(curl, CURLOPT_URL, "http://www.cmake.org/HTML/Index.html");
  37. res = curl_easy_perform(curl);
  38. /* always cleanup */
  39. curl_easy_cleanup(curl);
  40. }
  41. return 0;
  42. }