sourcemod/extensions/curl/curl-src/docs/examples/persistant.c

42 lines
1.1 KiB
C
Raw Normal View History

2013-03-18 01:55:59 +01:00
/*****************************************************************************
2009-01-09 00:31:00 +01:00
* _ _ ____ _
* Project ___| | | | _ \| |
* / __| | | | |_) | |
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
2013-03-18 01:55:59 +01:00
* $Id: persistant.c,v 1.4 2008-05-22 21:20:09 danf Exp $
*/
2009-01-09 00:31:00 +01:00
#include <stdio.h>
#include <unistd.h>
#include <curl/curl.h>
2013-03-18 01:55:59 +01:00
int main(int argc, char **argv)
2009-01-09 00:31:00 +01:00
{
CURL *curl;
CURLcode res;
curl_global_init(CURL_GLOBAL_ALL);
curl = curl_easy_init();
if(curl) {
curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L);
curl_easy_setopt(curl, CURLOPT_HEADER, 1L);
/* get the first document */
2013-03-18 01:55:59 +01:00
curl_easy_setopt(curl, CURLOPT_URL, "http://curl.haxx.se/");
2009-01-09 00:31:00 +01:00
res = curl_easy_perform(curl);
/* get another document from the same server using the same
connection */
2013-03-18 01:55:59 +01:00
curl_easy_setopt(curl, CURLOPT_URL, "http://curl.haxx.se/docs/");
2009-01-09 00:31:00 +01:00
res = curl_easy_perform(curl);
/* always cleanup */
curl_easy_cleanup(curl);
}
return 0;
}