libcurl官方实例代码(HTTP,FTP,上传下载等等)

2023-05-16

http://curl.haxx.se/libcurl/c/example.html


Some of the Examples

simple HTTP
simple.c shows how to get a remote web page in only four libcurl function calls.

simple HTTPS
https.c gets a single HTTPS page, while simplessl.c shows how to get a remote https page and a set of various SSL-controlling options.

get HTTP with headers separate
sepheader.c gets a web page and stores the response-headers in a separate file.

simple FTP
ftpget.c proves that getting a FTP file is just as simple.

FTP upload
ftpupload.c uploads a local file to a remote FTP server. It also renames the file after succcessful transfer.

get a remote file in memory only
getinmemory.c describes how you can use the callback system to fetch documents into a ram buffer with no file writing necessary.

HTTP PUT
httpput.c makes PUTs a local file to a HTTP server.

HTTP form POST
postit2.c shows how to build a RFC1867-style form post and send it to a HTTP server.

persistant transfers
persistant.c shows that just getting files in a sequential manner will make it use persistant connections if the remote server supports it.

multithreaded URL fetches
multithread.c starts a number of threads and retrieves one URL in each thread. This requires a working thread library.

URL fetch with GTK progress bar
curlgtk.c uses GTK and the libcurl progress callback to show a GUI progress bar while downloading.

fopen() URL
fopen.c shows how you could write an fopen()-style emulation layer to easily make your program read URLs instead of local files.

nonblocking multipart formpost
multi-post.c makes a multipart formpost using the multi interface, which makes it a non-blocking operation.

debug callback
debug.c shows how you can use the debug callback to get a full trace of all protocol data being sent/received (and more).

HTML parsing
htmltitle.cc shows how to use libxml to parse HTML retrieved with libcurl.

Using CURLOPT_SSL_CTX_FUNCTION
curlx.c uses CURLOPT_SSL_CTX_FUNCTION to set a custom callback to deal with an OpenSSL SSL_CTX * at SSL handshake time.

Doing SOAP with libcurl
SOAP example by vivtek.com

You'll also find these examples in the distribution archive, in the docs/examples directory.


复制去Google翻译 翻译结果
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

libcurl官方实例代码(HTTP,FTP,上传下载等等) 的相关文章

随机推荐

  • C语言实验——计算1到n的和(循环结构)

    include lt stdio h gt int main int i n sum 61 0 scanf 34 d 34 amp n for i 61 1 i lt 61 n i 43 43 sum 61 sum 43 i printf
  • ubuntu18.04安装Realsense D435i 摄像头的驱动SDK和ROS Wrapper

    ubuntu18 04安装Realsense D435i 摄像头的驱动SDK和ROS Wrapper 2022年更新 xff1a 安装教程同 xff1b 进更新安装包下载方式和下载链接 见文末 1 安装Realsense SDK 1 下载s
  • Window内置ubuntu安装与图形界面显示

    文章目录 一 Window安装ubuntu1 打开控制面板2 WSL升级1 xff09 启用适用于 Linux 的 Windows 子系统2 xff09 检查运行 WSL 2 的要求3 xff09 启用虚拟机功能4 xff09 下载 Lin
  • vscode超实用插件-REST Client

    背景 xff1a 作为前端开发 xff0c 经常需要进行接口调试 xff0c 比如常用的postman Rest client则是vscode推出的一款直接在vscode编辑器内就可以进行接口调试的插件 可以帮助我们快速在编辑器中进行接口调
  • 使用curl库,以post方式向服务器发送json数据

    使用curl库 xff0c 以post方式向服务器发送json数据 json数据的组合可以参考jsoncpp库 xff0c 也可以按json格式自己组合字符串 注意事项 xff0c 以下代码不可以多线程执行 xff0c 如果多线程执行 xf
  • STM32中printf重定向

    声明 xff1a 所有资源均来自于普中STM32F103开发板相关资料 xff0c 这是自己购买的一款开发板 xff0c 如果原作者认为侵权 xff0c 请联系我以便及时处理 printf重定向简介 C语言中printf函数默认输出设备是显
  • 解决ImportError: dlopen(/usr/local/Cellar/python/3.7.2_2/Frameworks/Python.framework/Versions/3.7/lib/

    import span class token punctuation span span class token string 34 ssl 34 span span class token punctuation span E Impo
  • linux JSON 解析命令 jq

    linux JSON 解析命令 jq 背景 前两天用终端curl请求服务端接口 xff0c 返回json格式数据有一些问题 xff0c 拿给开发看 xff0c 开发说你怎么不转换成json格式 xff0c 好看一点 xff0c 正准备把js
  • pip install 报错解决办法

    pip install 报错解决办法 报错如下 python m pip span class token function install span U pip Requirement already satisfied pip span
  • mac os+selenium2+chrome驱动+python3

    mac os 10 11 5 mac自带python2 7 xff0c 自己下载了python3 5 xff0c pip list查看系统中的安装包 xff0c 本人电脑中已经安装了pip和setuptools xff0c 若未安装 xff
  • redis服务启动和停止

    最近工作中需要使用redis内存数据库 xff0c 用的较多的师redis服务的启动与停止 xff0c 以及redis的常用命令 先简单了解一下redis xff0c redis是一个key value存储系统 和Memcached类似 x
  • sublime python环境(代码自动补全,调试python脚本等插件)

    用过sublime和pycharm xff0c 两款各有优缺点 xff0c 本人只是用来写一些脚本 xff0c 不开发大型项目 xff0c 选择轻量级的sublime编辑器 xff0c sublime需要根据开发语言 xff0c 自己安装一
  • 解决Vim插入模式下backspace按键无法删除字符的问题

    最近使用某个服务器编辑文件时 xff0c 快捷键i进入插入模式后 xff0c 下方不出现insert模式 xff0c 却可以插入字符 xff0c 但是backspace按键不能删除字符了 xff0c 最终google解决了此问题 xff0c
  • Kafka集群搭建详细步骤

    Kafka集群搭建 1 Kafka的安装需要java环境 xff0c cent os 7自带java1 6版本 xff0c 可以不用重新安装 xff0c 直接使用自带的jdk 即可 xff1b 如果觉得jdk版本太旧 xff0c 也可以自己
  • sublime text 3 打造python3环境(代码自动补全,运行程序,高亮显示)

    最近用python3用的比较多 xff0c 于是整理一下环境 xff0c 此博客仅记录下自己构造python3环境的过程 xff08 sublime text 3版本为3176 xff09 xff1a 安装的一些常用插件和配置过程如下 xf
  • 关于驱动程序的可移植性

    差不多所有的linux内核设备驱动都可以运行在不止一种处理器上 这仅仅因为设备驱动作者遵循一些重要规则 这些规则包括使用合适的变量类型 xff0c 而不是依赖于特定内存页大小 xff0c 提防外部数据的大小端模式 xff0c 设立合适的数据
  • centos7 安装mysql详细流程

    工作中经常需要安装mysql xff0c 每次安装的时候 xff0c 总是用不同的方法安装 xff0c 有错误就解决一下 xff0c 今天又重新装了一次mysql xff0c 记录下过程 xff0c 以后就用这种方式安装了 xff01 1
  • 10000端口无法运行

    1 查询端口 netstat ano findstr 10000 2 查询端口名 tasklist findstr 1572 3 关闭端口 taskkill pid 1572 F
  • Cmake编译-CMAKE_C_COMPILER-NOTFOUND解决

    第一次写博客 xff0c 其实就是记录一下从零开始的学习之路上遇到的各种 bug xff0c 一方面为了防止忘了犯过的错误 xff08 比如下一次 xff09 xff1b 另一方面为了从错误中汲取经历 分析 bug 之前 xff0c 记录一
  • libcurl官方实例代码(HTTP,FTP,上传下载等等)

    http curl haxx se libcurl c example html Some of the Examples simple HTTP simple c shows how to get a remote web page in