curl/docs/examples
Viktor Szakats dfdd978f7c
cmake: add BUILD_EXAMPLES option to build examples
You can enable it with `-DBUILD_EXAMPLES=ON`.

To match autotools' `make examples` feature.
Windows (static) builds not tested.

Also enable examples in a pair of CI jobs.

Apply related updates to the macOS CI workflow:
- drop unused `CXX` envs.
- drop no longer needed `-Wno-error=undef -Wno-error=conversion` flags.
- pass `-Wno-deprecated-declarations` to GCC too (for `BUILD_EXAMPLES`).
- document why `-Wno-deprecated-declarations` is necessary.

Closes #13491
2024-04-29 00:26:50 +02:00
..
.checksrc
.gitignore
10-at-a-time.c build: fix -Wconversion/-Wsign-conversion warnings 2023-12-20 15:38:45 +00:00
adddocsref.pl
address-scope.c examples: use present tense in comments 2024-02-27 16:19:43 +01:00
altsvc.c examples: use present tense in comments 2024-02-27 16:19:43 +01:00
anyauthput.c examples: use present tense in comments 2024-02-27 16:19:43 +01:00
cacertinmem.c examples: use present tense in comments 2024-02-27 16:19:43 +01:00
certinfo.c
chkspeed.c build: enable missing OpenSSF-recommended warnings, with fixes 2023-12-16 13:12:37 +00:00
CMakeLists.txt cmake: add BUILD_EXAMPLES option to build examples 2024-04-29 00:26:50 +02:00
connect-to.c examples: use present tense in comments 2024-02-27 16:19:43 +01:00
cookie_interface.c examples: use present tense in comments 2024-02-27 16:19:43 +01:00
crawler.c
debug.c build: enable missing OpenSSF-recommended warnings, with fixes 2023-12-16 13:12:37 +00:00
default-scheme.c examples: use present tense in comments 2024-02-27 16:19:43 +01:00
ephiperfifo.c examples: use present tense in comments 2024-02-27 16:19:43 +01:00
evhiperfifo.c examples: use present tense in comments 2024-02-27 16:19:43 +01:00
externalsocket.c examples: use present tense in comments 2024-02-27 16:19:43 +01:00
fileupload.c
ftp-wildcard.c examples: use present tense in comments 2024-02-27 16:19:43 +01:00
ftpget.c build: fix -Wconversion/-Wsign-conversion warnings 2023-12-20 15:38:45 +00:00
ftpgetinfo.c
ftpgetresp.c examples: use present tense in comments 2024-02-27 16:19:43 +01:00
ftpsget.c build: fix -Wconversion/-Wsign-conversion warnings 2023-12-20 15:38:45 +00:00
ftpupload.c examples: use present tense in comments 2024-02-27 16:19:43 +01:00
ftpuploadfrommem.c examples: use present tense in comments 2024-02-27 16:19:43 +01:00
ftpuploadresume.c examples: use present tense in comments 2024-02-27 16:19:43 +01:00
getinfo.c
getinmemory.c examples: use present tense in comments 2024-02-27 16:19:43 +01:00
getredirect.c examples: use present tense in comments 2024-02-27 16:19:43 +01:00
getreferrer.c examples: use present tense in comments 2024-02-27 16:19:43 +01:00
ghiper.c misc: Fix typos in docs and lib 2024-03-01 09:59:48 +01:00
headerapi.c examples: use present tense in comments 2024-02-27 16:19:43 +01:00
hiperfifo.c examples: use present tense in comments 2024-02-27 16:19:43 +01:00
href_extractor.c
hsts-preload.c examples: use present tense in comments 2024-02-27 16:19:43 +01:00
htmltidy.c
htmltitle.cpp
http2-download.c examples: use present tense in comments 2024-02-27 16:19:43 +01:00
http2-pushinmemory.c
http2-serverpush.c build: enable missing OpenSSF-recommended warnings, with fixes 2023-12-16 13:12:37 +00:00
http2-upload.c examples: use present tense in comments 2024-02-27 16:19:43 +01:00
http3-present.c
http3.c examples: use present tense in comments 2024-02-27 16:19:43 +01:00
http-options.c examples: use present tense in comments 2024-02-27 16:19:43 +01:00
http-post.c examples: use present tense in comments 2024-02-27 16:19:43 +01:00
httpcustomheader.c
httpput-postfields.c examples: use present tense in comments 2024-02-27 16:19:43 +01:00
httpput.c examples: use present tense in comments 2024-02-27 16:19:43 +01:00
https.c examples: use present tense in comments 2024-02-27 16:19:43 +01:00
imap-append.c examples: use present tense in comments 2024-02-27 16:19:43 +01:00
imap-authzid.c examples: use present tense in comments 2024-02-27 16:19:43 +01:00
imap-copy.c examples: use present tense in comments 2024-02-27 16:19:43 +01:00
imap-create.c
imap-delete.c
imap-examine.c
imap-fetch.c examples: use present tense in comments 2024-02-27 16:19:43 +01:00
imap-list.c examples: use present tense in comments 2024-02-27 16:19:43 +01:00
imap-lsub.c
imap-multi.c examples: use present tense in comments 2024-02-27 16:19:43 +01:00
imap-noop.c
imap-search.c
imap-ssl.c examples: use present tense in comments 2024-02-27 16:19:43 +01:00
imap-store.c
imap-tls.c examples: use present tense in comments 2024-02-27 16:19:43 +01:00
interface.c docs/examples/interface.c: show CURLOPT_INTERFACE use 2023-10-30 12:45:34 +01:00
ipv6.c examples/ipv6.c: new example showing IPv6-only internet transfer 2024-01-10 09:33:03 +01:00
keepalive.c docs/example/keepalive.c: show TCP keep-alive options 2023-11-01 10:57:15 +01:00
localport.c examples: use present tense in comments 2024-02-27 16:19:43 +01:00
Makefile.am
Makefile.example
Makefile.inc examples/range.c: add 2024-01-10 09:33:08 +01:00
Makefile.mk Makefile.mk: drop Windows support 2023-12-16 13:12:22 +00:00
maxconnects.c examples: use present tense in comments 2024-02-27 16:19:43 +01:00
multi-app.c examples: use present tense in comments 2024-02-27 16:19:43 +01:00
multi-debugcallback.c examples: use present tense in comments 2024-02-27 16:19:43 +01:00
multi-double.c
multi-event.c examples: use present tense in comments 2024-02-27 16:19:43 +01:00
multi-formadd.c
multi-legacy.c examples: use present tense in comments 2024-02-27 16:19:43 +01:00
multi-post.c
multi-single.c examples: use present tense in comments 2024-02-27 16:19:43 +01:00
multi-uv.c examples: use present tense in comments 2024-02-27 16:19:43 +01:00
multithread.c
netrc.c examples/netrc.c: add 2024-01-10 09:33:06 +01:00
parseurl.c examples: use present tense in comments 2024-02-27 16:19:43 +01:00
persistent.c examples: use present tense in comments 2024-02-27 16:19:43 +01:00
pop3-authzid.c examples: use present tense in comments 2024-02-27 16:19:43 +01:00
pop3-dele.c
pop3-list.c examples: use present tense in comments 2024-02-27 16:19:43 +01:00
pop3-multi.c examples: use present tense in comments 2024-02-27 16:19:43 +01:00
pop3-noop.c
pop3-retr.c examples: use present tense in comments 2024-02-27 16:19:43 +01:00
pop3-ssl.c examples: use present tense in comments 2024-02-27 16:19:43 +01:00
pop3-stat.c
pop3-tls.c examples: use present tense in comments 2024-02-27 16:19:43 +01:00
pop3-top.c
pop3-uidl.c
post-callback.c examples: use present tense in comments 2024-02-27 16:19:43 +01:00
postinmemory.c examples: use present tense in comments 2024-02-27 16:19:43 +01:00
postit2-formadd.c examples: use present tense in comments 2024-02-27 16:19:43 +01:00
postit2.c examples: use present tense in comments 2024-02-27 16:19:43 +01:00
progressfunc.c
protofeats.c
range.c examples: use present tense in comments 2024-02-27 16:19:43 +01:00
README.md
resolve.c examples: use present tense in comments 2024-02-27 16:19:43 +01:00
rtsp-options.c examples: use present tense in comments 2024-02-27 16:19:43 +01:00
sendrecv.c examples: use present tense in comments 2024-02-27 16:19:43 +01:00
sepheaders.c
sessioninfo.c
sftpget.c examples: use present tense in comments 2024-02-27 16:19:43 +01:00
sftpuploadresume.c
shared-connection-cache.c examples: use present tense in comments 2024-02-27 16:19:43 +01:00
simple.c examples: use present tense in comments 2024-02-27 16:19:43 +01:00
simplepost.c examples: use present tense in comments 2024-02-27 16:19:43 +01:00
simplessl.c misc: fix typos 2024-04-11 15:44:22 +02:00
smooth-gtk-thread.c examples: use present tense in comments 2024-02-27 16:19:43 +01:00
smtp-authzid.c examples: use present tense in comments 2024-02-27 16:19:43 +01:00
smtp-expn.c examples: use present tense in comments 2024-02-27 16:19:43 +01:00
smtp-mail.c examples: use present tense in comments 2024-02-27 16:19:43 +01:00
smtp-mime.c examples: use present tense in comments 2024-02-27 16:19:43 +01:00
smtp-multi.c examples: use present tense in comments 2024-02-27 16:19:43 +01:00
smtp-ssl.c examples: use present tense in comments 2024-02-27 16:19:43 +01:00
smtp-tls.c examples: use present tense in comments 2024-02-27 16:19:43 +01:00
smtp-vrfy.c examples: use present tense in comments 2024-02-27 16:19:43 +01:00
sslbackend.c
synctime.c examples: use present tense in comments 2024-02-27 16:19:43 +01:00
threaded-ssl.c
unixsocket.c examples: use present tense in comments 2024-02-27 16:19:43 +01:00
url2file.c
urlapi.c
usercertinmem.c examples: use present tense in comments 2024-02-27 16:19:43 +01:00
version-check.pl
websocket-cb.c examples: use present tense in comments 2024-02-27 16:19:43 +01:00
websocket.c examples: use present tense in comments 2024-02-27 16:19:43 +01:00
xmlstream.c

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. Just 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 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 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.