rv=curl_easy_setopt(ch,CURLOPT_WRITEHEADER, stderr);
rv=curl_easy_setopt(ch,CURLOPT_SSLCERTTYPE,"PEM");
rv=curl_easy_setopt(ch,CURLOPT_SSL_VERIFYPEER,1L);
- rv=curl_easy_setopt(ch, CURLOPT_URL, "https://www.cacert.org/");
+ rv=curl_easy_setopt(ch, CURLOPT_URL, "https://www.example.com/");
/* first try: retrieve page without cacerts' certificate -> will fail
*/
curl = curl_easy_init();
if(curl) {
- curl_easy_setopt(curl, CURLOPT_URL, "https://www.networking4all.com/");
+ curl_easy_setopt(curl, CURLOPT_URL, "https://www.example.com/");
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, wrfu);
if (curl) {
char nline[256];
- curl_easy_setopt(curl, CURLOPT_URL, "http://www.google.com/"); /* google.com sets "PREF" cookie */
+ curl_easy_setopt(curl, CURLOPT_URL, "http://www.example.com/");
curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L);
curl_easy_setopt(curl, CURLOPT_COOKIEFILE, ""); /* just to start the cookie engine */
res = curl_easy_perform(curl);
/* the DEBUGFUNCTION has no effect until we enable VERBOSE */
curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L);
- curl_easy_setopt(curl, CURLOPT_URL, "curl.haxx.se");
+ curl_easy_setopt(curl, CURLOPT_URL, "http://example.com/");
res = curl_easy_perform(curl);
/* always cleanup */
if(argc == 2)
curl_easy_setopt(handle, CURLOPT_URL, argv[1]);
else
- curl_easy_setopt(handle, CURLOPT_URL,
- "ftp://curltest.howto.cz:123456@curltest.howto.cz/test/*");
+ curl_easy_setopt(handle, CURLOPT_URL, "ftp://example.com/test/*");
/* and start transfer! */
rc = curl_easy_perform(handle);
curl = curl_easy_init();
if(curl) {
/*
- * Get curl 7.9.2 from sunet.se's FTP site. curl 7.9.2 is most likely not
- * present there by the time you read this, so you'd better replace the
- * URL with one that works!
+ * You better replace the URL with one that works!
*/
curl_easy_setopt(curl, CURLOPT_URL,
- "ftp://ftp.sunet.se/pub/www/utilities/curl/curl-7.9.2.tar.gz");
+ "ftp://ftp.example.com/pub/www/utilities/curl/curl-7.9.2.tar.gz");
/* Define our callback to get called when there's data to be written */
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, my_fwrite);
/* Set a pointer to our struct to pass to the callback */
int main(void)
{
- /* Check for binutils 2.19.1 from ftp.gnu.org's FTP site. */
- char ftpurl[] = "ftp://ftp.gnu.org/gnu/binutils/binutils-2.19.1.tar.bz2";
+ char ftpurl[] = "ftp://ftp.example.com/gnu/binutils/binutils-2.19.1.tar.bz2";
CURL *curl;
CURLcode res;
const time_t filetime;
curl = curl_easy_init();
if(curl) {
/* Get a file listing from sunet */
- curl_easy_setopt(curl, CURLOPT_URL, "ftp://ftp.sunet.se/");
+ curl_easy_setopt(curl, CURLOPT_URL, "ftp://ftp.example.com/");
curl_easy_setopt(curl, CURLOPT_WRITEDATA, ftpfile);
/* If you intend to use this on windows with a libcurl DLL, you must use
CURLOPT_WRITEFUNCTION as well */
#define LOCAL_FILE "/tmp/uploadthis.txt"
#define UPLOAD_FILE_AS "while-uploading.txt"
-#define REMOTE_URL "ftp://localhost/" UPLOAD_FILE_AS
+#define REMOTE_URL "ftp://example.com/" UPLOAD_FILE_AS
#define RENAME_FILE_TO "renamed-and-fine.txt"
/* NOTE: if you want this example to work on Windows with libcurl as a
/* parse headers for Content-Length */
-size_t getcontentlengthfunc(void *ptr, size_t size, size_t nmemb, void *stream) {
+size_t getcontentlengthfunc(void *ptr, size_t size, size_t nmemb, void *stream)
+{
int r;
long len = 0;
}
/* discard downloaded data */
-size_t discardfunc(void *ptr, size_t size, size_t nmemb, void *stream) {
+size_t discardfunc(void *ptr, size_t size, size_t nmemb, void *stream)
+{
return size * nmemb;
}
}
}
-int main(int c, char **argv) {
+int main(int c, char **argv)
+{
CURL *curlhandle = NULL;
curl_global_init(CURL_GLOBAL_ALL);
curlhandle = curl_easy_init();
- upload(curlhandle, "ftp://user:pass@host/path/file", "C:\\file", 0, 3);
+ upload(curlhandle, "ftp://user:pass@example.com/path/file", "C:\\file", 0, 3);
curl_easy_cleanup(curlhandle);
curl_global_cleanup();
curl = curl_easy_init();
if(curl) {
/* http://curl.haxx.se/libcurl/c/curl_easy_setopt.html#CURLOPTURL */
- curl_easy_setopt(curl, CURLOPT_URL, "curl.haxx.se");
+ curl_easy_setopt(curl, CURLOPT_URL, "http://www.example.com/");
/* http://curl.haxx.se/libcurl/c/curl_easy_perform.html */
res = curl_easy_perform(curl);
curl_handle = curl_easy_init();
/* specify URL to get */
- curl_easy_setopt(curl_handle, CURLOPT_URL, "http://cool.haxx.se/");
+ curl_easy_setopt(curl_handle, CURLOPT_URL, "http://www.example.com/");
/* send all data to this function */
curl_easy_setopt(curl_handle, CURLOPT_WRITEFUNCTION, WriteMemoryCallback);
curl = curl_easy_init();
if(curl) {
- curl_easy_setopt(curl, CURLOPT_URL, "https://sourceforge.net/");
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
#ifdef SKIP_PEER_VERIFICATION
/*
handles[i] = curl_easy_init();
/* set the options (I left out a few, you'll get the point anyway) */
- curl_easy_setopt(handles[HTTP_HANDLE], CURLOPT_URL, "http://website.com");
+ curl_easy_setopt(handles[HTTP_HANDLE], CURLOPT_URL, "http://example.com");
- curl_easy_setopt(handles[FTP_HANDLE], CURLOPT_URL, "ftp://ftpsite.com");
+ curl_easy_setopt(handles[FTP_HANDLE], CURLOPT_URL, "ftp://example.com");
curl_easy_setopt(handles[FTP_HANDLE], CURLOPT_UPLOAD, 1L);
/* init a multi stack */
http_handle = curl_easy_init();
/* set the options (I left out a few, you'll get the point anyway) */
- curl_easy_setopt(http_handle, CURLOPT_URL, "http://www.haxx.se/");
+ curl_easy_setopt(http_handle, CURLOPT_URL, "http://www.example.com/");
curl_easy_setopt(http_handle, CURLOPT_DEBUGFUNCTION, my_trace);
curl_easy_setopt(http_handle, CURLOPT_VERBOSE, 1L);
http_handle2 = curl_easy_init();
/* set options */
- curl_easy_setopt(http_handle, CURLOPT_URL, "http://www.haxx.se/");
+ curl_easy_setopt(http_handle, CURLOPT_URL, "http://www.example.com/");
/* set options */
curl_easy_setopt(http_handle2, CURLOPT_URL, "http://localhost/");
if(curl && multi_handle) {
/* what URL that receives this POST */
- curl_easy_setopt(curl, CURLOPT_URL,
- "http://www.fillinyoururl.com/upload.cgi");
+ curl_easy_setopt(curl, CURLOPT_URL, "http://www.example.com/upload.cgi");
curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L);
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headerlist);
http_handle = curl_easy_init();
/* set the options (I left out a few, you'll get the point anyway) */
- curl_easy_setopt(http_handle, CURLOPT_URL, "http://www.haxx.se/");
+ curl_easy_setopt(http_handle, CURLOPT_URL, "http://www.example.com/");
/* init a multi stack */
multi_handle = curl_multi_init();
curl_easy_setopt(curl, CURLOPT_HEADER, 1L);
/* get the first document */
- curl_easy_setopt(curl, CURLOPT_URL, "http://curl.haxx.se/");
+ curl_easy_setopt(curl, CURLOPT_URL, "http://example.com/");
res = curl_easy_perform(curl);
/* get another document from the same server using the same
connection */
- curl_easy_setopt(curl, CURLOPT_URL, "http://curl.haxx.se/docs/");
+ curl_easy_setopt(curl, CURLOPT_URL, "http://example.com/docs/");
res = curl_easy_perform(curl);
/* always cleanup */
curl = curl_easy_init();
if(curl) {
/* First set the URL that is about to receive our POST. */
- curl_easy_setopt(curl, CURLOPT_URL,
- "http://receivingsite.com.pooh/index.cgi");
+ curl_easy_setopt(curl, CURLOPT_URL, "http://example.com/index.cgi");
+
/* Now specify we want to POST data */
curl_easy_setopt(curl, CURLOPT_POST, 1L);
headerlist = curl_slist_append(headerlist, buf);
if(curl) {
/* what URL that receives this POST */
- curl_easy_setopt(curl, CURLOPT_URL, "http://curl.haxx.se/examplepost.cgi");
+ curl_easy_setopt(curl, CURLOPT_URL, "http://example.com/examplepost.cgi");
if ( (argc == 2) && (!strcmp(argv[1], "noexpectheader")) )
/* only disable 100-continue header if explicitly requested */
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headerlist);
curl = curl_easy_init();
if(curl) {
- curl_easy_setopt(curl, CURLOPT_URL, "curl.haxx.se");
+ curl_easy_setopt(curl, CURLOPT_URL, "http://example.com");
/* use platform-specific functions for codeset conversions */
curl_easy_setopt(curl, CURLOPT_CONV_FROM_NETWORK_FUNCTION,
CURL *curl;
CURLcode res;
/* Minimalistic http request */
- const char *request = "GET / HTTP/1.0\r\nHost: curl.haxx.se\r\n\r\n";
+ const char *request = "GET / HTTP/1.0\r\nHost: example.com\r\n\r\n";
int sockfd; /* socket */
size_t iolen;
curl = curl_easy_init();
if(curl) {
- curl_easy_setopt(curl, CURLOPT_URL, "curl.haxx.se");
+ curl_easy_setopt(curl, CURLOPT_URL, "http://example.com");
/* Do not do the transfer - only connect to host */
curl_easy_setopt(curl, CURLOPT_CONNECT_ONLY, 1L);
res = curl_easy_perform(curl);
curl_handle = curl_easy_init();
/* set URL to get */
- curl_easy_setopt(curl_handle, CURLOPT_URL, "http://curl.haxx.se");
+ curl_easy_setopt(curl_handle, CURLOPT_URL, "http://example.com");
/* no progress meter please */
curl_easy_setopt(curl_handle, CURLOPT_NOPROGRESS, 1L);
curl = curl_easy_init();
if(curl) {
- curl_easy_setopt(curl, CURLOPT_URL, "curl.haxx.se");
+ curl_easy_setopt(curl, CURLOPT_URL, "http://example.com");
res = curl_easy_perform(curl);
/* always cleanup */
curl = curl_easy_init();
if(curl) {
- curl_easy_setopt(curl, CURLOPT_URL, "http://posthere.com");
+ curl_easy_setopt(curl, CURLOPT_URL, "http://example.com");
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, postthis);
/* if we don't provide POSTFIELDSIZE, libcurl will strlen() by
/* List of URLs to fetch.*/
const char * const urls[]= {
- "https://www.sf.net/",
- "https://www.openssl.org/",
- "https://www.sf.net/",
- "https://www.openssl.org/",
+ "https://www.example.com/",
+ "https://www2.example.com/",
+ "https://www3.example.com/",
+ "https://www4.example.com/",
};
static void *pull_one_url(void *url)