查看“Curl”的源代码
←
Curl
跳到导航
跳到搜索
因为以下原因,您没有权限编辑本页:
您所请求的操作仅限于该用户组的用户使用:
用户
您可以查看和复制此页面的源代码。
=== 参考 === https://www.ruanyifeng.com/blog/2019/09/curl-reference.html https://4sysops.com/archives/how-to-use-curl-on-windows/#rtoc-3 https://www.booleanworld.com/curl-command-tutorial-examples/ === 安装 === ==== Linux ==== ===== apk 安装 ===== <syntaxhighlight lang="shell-session"> ~ # apk add curl fetch https://dl-cdn.alpinelinux.org/alpine/v3.16/main/x86_64/APKINDEX.tar.gz fetch https://dl-cdn.alpinelinux.org/alpine/v3.16/community/x86_64/APKINDEX.tar.gz (1/4) Installing brotli-libs (1.0.9-r6) (2/4) Installing nghttp2-libs (1.47.0-r0) (3/4) Installing libcurl (7.83.1-r2) (4/4) Installing curl (7.83.1-r2) Executing busybox-1.35.0-r13.trigger OK: 12 MiB in 21 packages ~ # </syntaxhighlight> ==== Windows ==== https://curl.se/windows/ === 使用示例 === [[Curl 使用示例]] ==== Linux 版 ==== <syntaxhighlight lang="shell-session"> curl --location --request GET 'https://www.douyin.com/user/abcd' \ --header 'accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9' \ --header 'accept-encoding: gzip, deflate, br' \ --header 'accept-language: en' \ --header 'cache-control: max-age=0' \ --header 'referer: https://www.douyin.com/user/abcd' \ --header 'sec-ch-ua: "Not?A_Brand";v="8", "Chromium";v="108", "Google Chrome";v="108"' \ --header 'sec-ch-ua-mobile: ?0' \ --header 'sec-ch-ua-platform: "Windows"' \ --header 'sec-fetch-dest: document' \ --header 'sec-fetch-mode: navigate' \ --header 'sec-fetch-site: same-origin' \ --header 'upgrade-insecure-requests: 1' \ --header 'user-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36' --output - </syntaxhighlight> ==== Windows 版 ==== <syntaxhighlight lang="powershell"> curl --location --request GET "https://www.douyin.com/user/abcd" ^ --header "accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9" ^ --header "accept-encoding: gzip, deflate, br" ^ --header "accept-language: en" ^ --header "cache-control: max-age=0" ^ --header "referer: https://www.douyin.com/user/abcd" ^ --header "sec-ch-ua: \"Not?A_Brand\";v=\"8\", \"Chromium\";v=\"108\", \"Google Chrome\";v=\"108\"" ^ --header "sec-ch-ua-mobile: ?0" ^ --header "sec-ch-ua-platform: \"Windows\"" ^ --header "sec-fetch-dest: document" ^ --header "sec-fetch-mode: navigate" ^ --header "sec-fetch-site: same-origin" ^ --header "upgrade-insecure-requests: 1" ^ --header "user-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36" ^ --output - </syntaxhighlight> Windows 多行命令用 ^ 换行,Linux 里用 \ 换行; --output 后面跟文件路径,指示将响应内容输出到文件;当后面跟 - 的时候表示无论如何(即使是非文本的二进制文件)输出到控制台中。 Linux 中 --header 后面的参数使用 '(单引号)包裹,Windows 中用 "(双引号)包裹,且对字符串中的双引号加以转义。 === 参数说明 === -o 和 -O 不是一个意思 -O, --remote-name Write output to a file named as the remote file -o, --output <file> Write to file instead of stdout --output-dir <dir> Directory to save files in -s 和 -sS 不是一个意思 -s/--silent Silent or quiet mode. Don't show progress meter or error messages. Makes Curl mute. -S/--show-error When used with -s it makes curl show an error message if it fails. 参数区分大小写 -L, --location Follow redirects(3xx)
返回至
Curl
。
导航菜单
个人工具
登录
名字空间
页面
讨论
变种
视图
阅读
查看源代码
查看历史
更多
搜索
导航
首页
Spring Boot 2 零基础入门
Spring Cloud
Spring Boot
设计模式之禅
VUE
Vuex
Maven
算法
技能树
Wireshark
IntelliJ IDEA
ElasticSearch
VirtualBox
软考
正则表达式
程序员精讲
软件设计师精讲
初级程序员 历年真题
C
SQL
Java
FFmpeg
Redis
Kafka
MySQL
Spring
Docker
JMeter
Apache
Linux
Windows
Git
ZooKeeper
设计模式
Python
MyBatis
软件
数学
PHP
IntelliJ IDEA
CS基础知识
网络
项目
未分类
MediaWiki
镜像
问题
健身
国债
英语
烹饪
常见术语
MediaWiki帮助
工具
链入页面
相关更改
特殊页面
页面信息