aboutsummaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2001-03-27 09:00:18 +0000
committerDaniel Stenberg <daniel@haxx.se>2001-03-27 09:00:18 +0000
commit053bf49bd24db8fe8f4556291100f9b99bb2c4a0 (patch)
treeeb108fa40339574edf109f3f4f7e80b5fec722f1 /docs
parent8b08dfed38a9c9db72b124dd66ca76165574b427 (diff)
Added ftpget.c just to show that it is exactly as easy to get FTP files
Diffstat (limited to 'docs')
-rw-r--r--docs/examples/Makefile.am3
-rw-r--r--docs/examples/ftpget.c44
2 files changed, 45 insertions, 2 deletions
diff --git a/docs/examples/Makefile.am b/docs/examples/Makefile.am
index 176e7b6f2..7f7628634 100644
--- a/docs/examples/Makefile.am
+++ b/docs/examples/Makefile.am
@@ -6,8 +6,7 @@ AUTOMAKE_OPTIONS = foreign no-dependencies
EXTRA_DIST =
README curlgtk.c sepheaders.c simple.c postit.c \
- win32sockets.c persistant.c \
- getpageinvar.php simpleget.php simplepost.php
+ win32sockets.c persistant.c ftpget.c
all:
@echo "done"
diff --git a/docs/examples/ftpget.c b/docs/examples/ftpget.c
new file mode 100644
index 000000000..bdf854521
--- /dev/null
+++ b/docs/examples/ftpget.c
@@ -0,0 +1,44 @@
+/*****************************************************************************
+ * _ _ ____ _
+ * Project ___| | | | _ \| |
+ * / __| | | | |_) | |
+ * | (__| |_| | _ <| |___
+ * \___|\___/|_| \_\_____|
+ *
+ * $Id$
+ */
+
+#include <stdio.h>
+
+#include <curl/curl.h>
+#include <curl/types.h>
+#include <curl/easy.h>
+
+/* to make this work under windows, use the win32-functions from the
+ win32socket.c file as well */
+
+int main(int argc, char **argv)
+{
+ CURL *curl;
+ CURLcode res;
+ FILE *ftpfile;
+
+ /* local file name to store the file as */
+ ftpfile = fopen("curl.tar.gz", "wb"); /* b is binary for win */
+
+ curl = curl_easy_init();
+ if(curl) {
+ /* Get curl 7.7 from sunet.se's FTP site: */
+ curl_easy_setopt(curl, CURLOPT_URL,
+ "ftp://ftp.sunet.se/pub/www/utilities/curl/curl-7.7.tar.gz");
+ curl_easy_setopt(curl, CURLOPT_FILE, ftpfile);
+ res = curl_easy_perform(curl);
+
+ /* always cleanup */
+ curl_easy_cleanup(curl);
+ }
+
+ fclose(ftpfile); /* close the local file */
+
+ return 0;
+}