curl/docs/examples
2026-06-13 00:09:22 +02:00
..
.checksrc build: tidy up curl-specific fstat calls and stat struct type 2026-02-02 18:57:13 +01:00
.gitignore examples/threaded-ssl: delete in favor of examples/threaded 2025-12-17 00:32:20 +01:00
10-at-a-time.c build: enable -Wformat-signedness, fix issues found 2026-06-10 15:14:08 +02:00
adddocsref.pl tidy-up: add spaces around equal operators where missing 2026-06-11 19:52:01 +02:00
address-scope.c docs: compare result against literal CURLE_OK (where missing) 2026-02-07 19:40:45 +01:00
altsvc.c docs: compare result against literal CURLE_OK (where missing) 2026-02-07 19:40:45 +01:00
anyauthput.c tidy-up: drop stray comparisons with literal zero 2026-06-10 15:15:54 +02:00
block_ip.c badwords: rework exceptions, fix many of them 2026-03-12 01:01:16 +01:00
cacertinmem.c tidy-up: miscellaneous 2026-05-20 00:50:43 +02:00
certinfo.c docs: use the correct CURLOPT_WRITEFUNCTION signature 2026-04-08 11:25:54 +02:00
chkspeed.c tidy-up: miscellaneous 2026-06-11 19:48:07 +02:00
CMakeLists.txt cmake: drop support for CMake 3.17 and older 2026-03-21 13:24:47 +01:00
connect-to.c docs: compare result against literal CURLE_OK (where missing) 2026-02-07 19:40:45 +01:00
cookie_interface.c docs: compare result against literal CURLE_OK (where missing) 2026-02-07 19:40:45 +01:00
crawler.c tidy-up: drop redundant != NULL syntax 2026-06-09 14:37:36 +02:00
debug.c tidy-up: miscellaneous 2026-04-14 01:08:32 +02:00
default-scheme.c docs: compare result against literal CURLE_OK (where missing) 2026-02-07 19:40:45 +01:00
ephiperfifo.c tidy-up: drop stray comparisons with literal zero 2026-06-10 15:15:54 +02:00
evhiperfifo.c tidy-up: drop stray comparisons with literal zero 2026-06-10 15:15:54 +02:00
externalsocket.c build: enable -Wformat-signedness, fix issues found 2026-06-10 15:14:08 +02:00
fileupload.c tidy-up: drop stray comparisons with literal zero 2026-06-10 15:15:54 +02:00
ftp-delete.c build: enable -Wformat-signedness, fix issues found 2026-06-10 15:14:08 +02:00
ftp-wildcard.c docs: compare result against literal CURLE_OK (where missing) 2026-02-07 19:40:45 +01:00
ftpget.c build: enable -Wformat-signedness, fix issues found 2026-06-10 15:14:08 +02:00
ftpgetinfo.c build: enable -Wformat-signedness, fix issues found 2026-06-10 15:14:08 +02:00
ftpgetresp.c docs: compare result against literal CURLE_OK (where missing) 2026-02-07 19:40:45 +01:00
ftpsget.c build: enable -Wformat-signedness, fix issues found 2026-06-10 15:14:08 +02:00
ftpupload.c tidy-up: drop stray comparisons with literal zero 2026-06-10 15:15:54 +02:00
ftpuploadfrommem.c docs: rename CURLcode variables to 'result' 2025-12-17 08:55:12 +01:00
ftpuploadresume.c docs: use the correct CURLOPT_WRITEFUNCTION signature 2026-04-08 11:25:54 +02:00
getinfo.c docs: compare result against literal CURLE_OK (where missing) 2026-02-07 19:40:45 +01:00
getinmemory.c docs: use the correct CURLOPT_WRITEFUNCTION signature 2026-04-08 11:25:54 +02:00
getredirect.c docs: compare result against literal CURLE_OK (where missing) 2026-02-07 19:40:45 +01:00
getreferrer.c docs: compare result against literal CURLE_OK (where missing) 2026-02-07 19:40:45 +01:00
ghiper.c tidy-up: drop stray comparisons with literal zero 2026-06-10 15:15:54 +02:00
headerapi.c stop using the word 'just' 2026-03-03 15:30:22 +01:00
hiperfifo.c tidy-up: drop stray comparisons with literal zero 2026-06-10 15:15:54 +02:00
hsts-preload.c docs: compare result against literal CURLE_OK (where missing) 2026-02-07 19:40:45 +01:00
htmltidy.c tidy-up: miscellaneous 2026-02-25 14:44:56 +01:00
htmltitle.cpp tidy-up: drop redundant == NULL syntax 2026-06-09 14:37:36 +02:00
http-options.c docs: compare result against literal CURLE_OK (where missing) 2026-02-07 19:40:45 +01:00
http-post.c stop using the word 'just' 2026-03-03 15:30:22 +01:00
http2-download.c tidy-up: miscellaneous 2026-06-11 19:48:07 +02:00
http2-pushinmemory.c docs: use the correct CURLOPT_WRITEFUNCTION signature 2026-04-08 11:25:54 +02:00
http2-serverpush.c docs: compare result against literal CURLE_OK (where missing) 2026-02-07 19:40:45 +01:00
http2-upload.c tidy-up: miscellaneous 2026-06-11 19:48:07 +02:00
http3-present.c docs: compare result against literal CURLE_OK (where missing) 2026-02-07 19:40:45 +01:00
http3.c docs: compare result against literal CURLE_OK (where missing) 2026-02-07 19:40:45 +01:00
httpcustomheader.c docs: compare result against literal CURLE_OK (where missing) 2026-02-07 19:40:45 +01:00
httpput-postfields.c badwords: rework exceptions, fix many of them 2026-03-12 01:01:16 +01:00
httpput.c tidy-up: drop stray comparisons with literal zero 2026-06-10 15:15:54 +02:00
https.c docs: compare result against literal CURLE_OK (where missing) 2026-02-07 19:40:45 +01:00
imap-append.c or higher -> or greater 12 examples 2026-06-13 00:09:22 +02:00
imap-authzid.c or higher -> or greater 12 examples 2026-06-13 00:09:22 +02:00
imap-copy.c or higher -> or greater 12 examples 2026-06-13 00:09:22 +02:00
imap-create.c or higher -> or greater 12 examples 2026-06-13 00:09:22 +02:00
imap-delete.c or higher -> or greater 12 examples 2026-06-13 00:09:22 +02:00
imap-examine.c or higher -> or greater 12 examples 2026-06-13 00:09:22 +02:00
imap-fetch.c or higher -> or greater 12 examples 2026-06-13 00:09:22 +02:00
imap-list.c or higher -> or greater 12 examples 2026-06-13 00:09:22 +02:00
imap-lsub.c or higher -> or greater 12 examples 2026-06-13 00:09:22 +02:00
imap-multi.c docs: compare result against literal CURLE_OK (where missing) 2026-02-07 19:40:45 +01:00
imap-noop.c or higher -> or greater 12 examples 2026-06-13 00:09:22 +02:00
imap-search.c or higher -> or greater 12 examples 2026-06-13 00:09:22 +02:00
imap-ssl.c or higher -> or greater 12 examples 2026-06-13 00:09:22 +02:00
imap-store.c or higher -> or greater 12 examples 2026-06-13 00:09:22 +02:00
imap-tls.c or higher -> or greater 12 examples 2026-06-13 00:09:22 +02:00
interface.c docs: compare result against literal CURLE_OK (where missing) 2026-02-07 19:40:45 +01:00
ipv6.c docs: compare result against literal CURLE_OK (where missing) 2026-02-07 19:40:45 +01:00
keepalive.c docs: compare result against literal CURLE_OK (where missing) 2026-02-07 19:40:45 +01:00
localport.c docs: compare result against literal CURLE_OK (where missing) 2026-02-07 19:40:45 +01:00
log_failed_transfers.c build: enable -Wformat-signedness, fix issues found 2026-06-10 15:14:08 +02:00
Makefile.am cmake: support building some complicated examples, build them in CI 2025-10-07 19:09:02 +02:00
Makefile.example Makefile.example: make default options more likely to work 2025-10-20 13:52:58 +02:00
Makefile.inc examples/threaded-ssl: delete in favor of examples/threaded 2025-12-17 00:32:20 +01:00
maxconnects.c tidy-up: miscellaneous 2026-02-25 14:44:56 +01:00
multi-app.c build: enable -Wformat-signedness, fix issues found 2026-06-10 15:14:08 +02:00
multi-debugcallback.c tidy-up: miscellaneous 2026-04-14 01:08:32 +02:00
multi-double.c badwords: avoid 'simply' 2026-03-10 19:34:06 +01:00
multi-event.c tidy-up: drop stray casts for allocated pointers 2026-06-05 12:24:01 +02:00
multi-formadd.c docs: compare result against literal CURLE_OK (where missing) 2026-02-07 19:40:45 +01:00
multi-legacy.c build: enable -Wformat-signedness, fix issues found 2026-06-10 15:14:08 +02:00
multi-post.c docs: compare result against literal CURLE_OK (where missing) 2026-02-07 19:40:45 +01:00
multi-single.c badwords: avoid 'simply' 2026-03-10 19:34:06 +01:00
multi-uv.c tidy-up: drop stray casts for allocated pointers 2026-06-05 12:24:01 +02:00
netrc.c docs: compare result against literal CURLE_OK (where missing) 2026-02-07 19:40:45 +01:00
parseurl.c or higher -> or greater 12 examples 2026-06-13 00:09:22 +02:00
persistent.c docs: compare result against literal CURLE_OK (where missing) 2026-02-07 19:40:45 +01:00
pop3-authzid.c or higher -> or greater 12 examples 2026-06-13 00:09:22 +02:00
pop3-dele.c or higher -> or greater 12 examples 2026-06-13 00:09:22 +02:00
pop3-list.c or higher -> or greater 12 examples 2026-06-13 00:09:22 +02:00
pop3-multi.c docs: compare result against literal CURLE_OK (where missing) 2026-02-07 19:40:45 +01:00
pop3-noop.c or higher -> or greater 12 examples 2026-06-13 00:09:22 +02:00
pop3-retr.c or higher -> or greater 12 examples 2026-06-13 00:09:22 +02:00
pop3-ssl.c or higher -> or greater 12 examples 2026-06-13 00:09:22 +02:00
pop3-stat.c or higher -> or greater 12 examples 2026-06-13 00:09:22 +02:00
pop3-tls.c or higher -> or greater 12 examples 2026-06-13 00:09:22 +02:00
pop3-top.c or higher -> or greater 12 examples 2026-06-13 00:09:22 +02:00
pop3-uidl.c or higher -> or greater 12 examples 2026-06-13 00:09:22 +02:00
post-callback.c docs: rename CURLcode variables to 'result' 2025-12-17 08:55:12 +01:00
postinmemory.c docs: use the correct CURLOPT_WRITEFUNCTION signature 2026-04-08 11:25:54 +02:00
postit2-formadd.c docs: compare result against literal CURLE_OK (where missing) 2026-02-07 19:40:45 +01:00
postit2.c docs: compare result against literal CURLE_OK (where missing) 2026-02-07 19:40:45 +01:00
progressfunc.c docs: compare result against literal CURLE_OK (where missing) 2026-02-07 19:40:45 +01:00
protofeats.c docs: compare result against literal CURLE_OK (where missing) 2026-02-07 19:40:45 +01:00
range.c docs: compare result against literal CURLE_OK (where missing) 2026-02-07 19:40:45 +01:00
README.md stop using the word 'just' 2026-03-03 15:30:22 +01:00
resolve.c docs: compare result against literal CURLE_OK (where missing) 2026-02-07 19:40:45 +01:00
rtsp-options.c docs: compare result against literal CURLE_OK (where missing) 2026-02-07 19:40:45 +01:00
sendrecv.c gcc: guard #pragma diagnostic in core code for <4.6, disable picky warnings 2026-03-18 11:33:37 +01:00
sepheaders.c docs: use the correct CURLOPT_WRITEFUNCTION signature 2026-04-08 11:25:54 +02:00
sessioninfo.c docs: use the correct CURLOPT_WRITEFUNCTION signature 2026-04-08 11:25:54 +02:00
sftpget.c build: enable -Wformat-signedness, fix issues found 2026-06-10 15:14:08 +02:00
sftpuploadresume.c docs: compare result against literal CURLE_OK (where missing) 2026-02-07 19:40:45 +01:00
shared-connection-cache.c docs: compare result against literal CURLE_OK (where missing) 2026-02-07 19:40:45 +01:00
simple.c docs: compare result against literal CURLE_OK (where missing) 2026-02-07 19:40:45 +01:00
simplepost.c docs: compare result against literal CURLE_OK (where missing) 2026-02-07 19:40:45 +01:00
simplessl.c tidy-up: miscellaneous 2026-05-20 00:50:43 +02:00
smooth-gtk-thread.c tidy-up: drop stray comparisons with literal zero 2026-06-10 15:15:54 +02:00
smtp-authzid.c or higher -> or greater 12 examples 2026-06-13 00:09:22 +02:00
smtp-expn.c or higher -> or greater 12 examples 2026-06-13 00:09:22 +02:00
smtp-mail.c stop using the word 'just' 2026-03-03 15:30:22 +01:00
smtp-mime.c or higher -> or greater 12 examples 2026-06-13 00:09:22 +02:00
smtp-multi.c stop using the word 'just' 2026-03-03 15:30:22 +01:00
smtp-ssl.c or higher -> or greater 12 examples 2026-06-13 00:09:22 +02:00
smtp-tls.c or higher -> or greater 12 examples 2026-06-13 00:09:22 +02:00
smtp-vrfy.c or higher -> or greater 12 examples 2026-06-13 00:09:22 +02:00
sslbackend.c or higher -> or greater 12 examples 2026-06-13 00:09:22 +02:00
synctime.c tidy-up: drop stray comparisons with literal zero 2026-06-10 15:15:54 +02:00
threaded.c build: drop redundant HAVE_PTHREAD_H guard 2026-03-30 18:57:07 +02:00
unixsocket.c tidy-up: miscellaneous 2026-02-12 14:52:16 +01:00
url2file.c docs: use the correct CURLOPT_WRITEFUNCTION signature 2026-04-08 11:25:54 +02:00
urlapi.c or higher -> or greater 12 examples 2026-06-13 00:09:22 +02:00
usercertinmem.c docs: use the correct CURLOPT_WRITEFUNCTION signature 2026-04-08 11:25:54 +02:00
version-check.pl tidy-up: add spaces around equal operators where missing 2026-06-11 19:52:01 +02:00
websocket-cb.c docs: compare result against literal CURLE_OK (where missing) 2026-02-07 19:40:45 +01:00
websocket-updown.c build: enable -Wformat-signedness, fix issues found 2026-06-10 15:14:08 +02:00
websocket.c build: enable -Wformat-signedness, fix issues found 2026-06-10 15:14:08 +02:00
xmlstream.c docs: compare result against literal CURLE_OK (where missing) 2026-02-07 19:40:45 +01:00

libcurl examples

This directory is for libcurl programming examples. They are meant to show some simple steps on how you can build your own application to take full advantage of libcurl.

If you end up with other small but still useful example sources, please mail them for submission in future packages and on the website.

Building

The Makefile.example is an example Makefile that could be used to build these examples. Edit the file according to your system and requirements first.

Most examples should build fine using a command line like this:

`curl-config --cc --cflags --libs` -o example-my example.c

Some compilers do not like having the arguments in this order but instead want you do reorganize them like:

`curl-config --cc` -o example-my example.c `curl-config --cflags --libs`

Please do not use the curl.se site as a test target for your libcurl applications/experiments. Even if some of the examples use that site as a URL at some places, it does not mean that the URLs work or that we expect you to actually torture our website with your tests. Thanks.

Examples

Each example source code file is designed to be and work stand-alone and rather self-explanatory. The examples may at times lack the level of error checks you need in a real world, but that is then only for the sake of readability: to make the code smaller and easier to follow.