<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="zh-Hans-CN">
	<id>http://wiki.eijux.com/index.php?action=history&amp;feed=atom&amp;title=Curl_%E7%94%A8%E6%B3%95%E6%8C%87%E5%8D%97</id>
	<title>Curl 用法指南 - 版本历史</title>
	<link rel="self" type="application/atom+xml" href="http://wiki.eijux.com/index.php?action=history&amp;feed=atom&amp;title=Curl_%E7%94%A8%E6%B3%95%E6%8C%87%E5%8D%97"/>
	<link rel="alternate" type="text/html" href="http://wiki.eijux.com/index.php?title=Curl_%E7%94%A8%E6%B3%95%E6%8C%87%E5%8D%97&amp;action=history"/>
	<updated>2026-05-15T18:41:40Z</updated>
	<subtitle>本wiki上该页面的版本历史</subtitle>
	<generator>MediaWiki 1.38.2</generator>
	<entry>
		<id>http://wiki.eijux.com/index.php?title=Curl_%E7%94%A8%E6%B3%95%E6%8C%87%E5%8D%97&amp;diff=3824&amp;oldid=prev</id>
		<title>Eijux：​建立内容为“category:curl  == 关于 == 【转自：'''[http://www.ruanyifeng.com/blog/2019/09/curl-reference.html http://www.ruanyifeng.com/blog/2019/09/curl-reference.h…”的新页面</title>
		<link rel="alternate" type="text/html" href="http://wiki.eijux.com/index.php?title=Curl_%E7%94%A8%E6%B3%95%E6%8C%87%E5%8D%97&amp;diff=3824&amp;oldid=prev"/>
		<updated>2021-05-22T17:15:52Z</updated>

		<summary type="html">&lt;p&gt;建立内容为“&lt;a href=&quot;/%E5%88%86%E7%B1%BB:Curl&quot; title=&quot;分类:Curl&quot;&gt;category:curl&lt;/a&gt;  == 关于 == 【转自：&amp;#039;&amp;#039;&amp;#039;[http://www.ruanyifeng.com/blog/2019/09/curl-reference.html http://www.ruanyifeng.com/blog/2019/09/curl-reference.h…”的新页面&lt;/p&gt;
&lt;p&gt;&lt;b&gt;新页面&lt;/b&gt;&lt;/p&gt;&lt;div&gt;[[category:curl]]&lt;br /&gt;
&lt;br /&gt;
== 关于 ==&lt;br /&gt;
【转自：'''[http://www.ruanyifeng.com/blog/2019/09/curl-reference.html http://www.ruanyifeng.com/blog/2019/09/curl-reference.html]'''】&lt;br /&gt;
&lt;br /&gt;
=== -A ===&lt;br /&gt;
'''-A''' 参数'''指定客户端的用户代理标头'''，即 '''User-Agent'''。&lt;br /&gt;
* curl 的默认用户代理字符串是&amp;lt;code&amp;gt;'''curl/[version]'''&amp;lt;/code&amp;gt;。&lt;br /&gt;
* 也可以通过&amp;lt;code&amp;gt;'''-H'''&amp;lt;/code&amp;gt;参数直接指定标头，更改 User-Agent。&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
示例：&lt;br /&gt;
# 将User-Agent改成 Chrome 浏览器：&lt;br /&gt;
#: &amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot; highlight=&amp;quot;&amp;quot;&amp;gt;&lt;br /&gt;
$ curl -A 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.100 Safari/537.36' https://google.com&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
# 移除User-Agent标头：&lt;br /&gt;
#: &amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot; highlight=&amp;quot;&amp;quot;&amp;gt;&lt;br /&gt;
$ curl -A '' https://google.com&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
# 通过 -H 参数指定标头：&lt;br /&gt;
#: &amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot; highlight=&amp;quot;&amp;quot;&amp;gt;&lt;br /&gt;
$ curl -H 'User-Agent: php/1.0' https://google.com&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== -b ===&lt;br /&gt;
'''-b''' 参数用来'''向服务器发送 Cookie'''。&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
示例：&lt;br /&gt;
# 生成一个标头Cookie: foo=bar，向服务器发送一个名为foo、值为bar的 Cookie：&lt;br /&gt;
#: &amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot; highlight=&amp;quot;&amp;quot;&amp;gt;&lt;br /&gt;
$ curl -b 'foo=bar' https://google.com&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
# 发送两个 Cookie：&lt;br /&gt;
#: &amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot; highlight=&amp;quot;&amp;quot;&amp;gt;&lt;br /&gt;
$ curl -b 'foo1=bar;foo2=bar2' https://google.com&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
# 读取本地文件“cookies.txt”，里面是服务器设置的 Cookie（参见-c参数），将其发送到服务器：&lt;br /&gt;
#: &amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot; highlight=&amp;quot;&amp;quot;&amp;gt;&lt;br /&gt;
$ curl -b cookies.txt https://www.google.com&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== -c ===&lt;br /&gt;
'''-c''' 参数'''将服务器设置的 Cookie 写入一个文件'''。&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
示例：&lt;br /&gt;
# 服务器的 HTTP 回应所设置 Cookie 写入文本文件“cookies.txt”：&lt;br /&gt;
#: &amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot; highlight=&amp;quot;&amp;quot;&amp;gt;&lt;br /&gt;
$ curl -c cookies.txt https://www.google.com&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== -d ===&lt;br /&gt;
'''-d'''参数用于'''发送 POST 请求的数据体'''。&lt;br /&gt;
* -d参数可以读取本地文本文件的数据，向服务器发送。&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot; highlight=&amp;quot;&amp;quot;&amp;gt;&lt;br /&gt;
$ curl -d'login=emma＆password=123'-X POST https://google.com/login&lt;br /&gt;
# 或者&lt;br /&gt;
$ curl -d 'login=emma' -d 'password=123' -X POST  https://google.com/login&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
使用 -d 参数以后：&lt;br /&gt;
* HTTP 请求会自动加上标头 &amp;lt;code&amp;gt;Content-Type : application/x-www-form-urlencoded&amp;lt;/code&amp;gt;。&lt;br /&gt;
* 并且会自动将请求转为 POST 方法，因此可以省略 &amp;lt;code&amp;gt;-X POST&amp;lt;/code&amp;gt;。&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
示例：&lt;br /&gt;
# 读取“data.txt”文件的内容，作为数据体向服务器发送：&lt;br /&gt;
#: &amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot; highlight=&amp;quot;&amp;quot;&amp;gt;&lt;br /&gt;
$ curl -d '@data.txt' https://google.com/login&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== --data-urlencode ===&lt;br /&gt;
'''--data-urlencode''' 参数等同于 '''-d'''，发送 POST 请求的数据体，区别在于'''会自动将发送的数据进行 URL 编码'''。&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
示例：&lt;br /&gt;
# 发送的数据hello world之间有一个空格，需要进行 URL 编码：&lt;br /&gt;
#: &amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot; highlight=&amp;quot;&amp;quot;&amp;gt;&lt;br /&gt;
$ curl --data-urlencode 'comment=hello world' https://google.com/login&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== -e ===&lt;br /&gt;
'''-e''' 参数用来设置 HTTP 的标头 Referer，表示'''请求的来源'''。&lt;br /&gt;
* '''-H'''参数可以通过直接添加标头 Referer，达到同样效果。&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
示例：&lt;br /&gt;
# 将 Referer 标头设为 “https://google.com?q=example”：&lt;br /&gt;
#: &amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot; highlight=&amp;quot;&amp;quot;&amp;gt;&lt;br /&gt;
curl -e 'https://google.com?q=example' https://www.example.com&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
# 通过 -H 参数直接添加标头Referer：&lt;br /&gt;
#: &amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot; highlight=&amp;quot;&amp;quot;&amp;gt;&lt;br /&gt;
curl -H 'Referer: https://google.com?q=example' https://www.example.com&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== -F ===&lt;br /&gt;
'''-F''' 参数用来向服务器'''上传二进制文件'''。&lt;br /&gt;
&lt;br /&gt;
-F 参数还可以：&lt;br /&gt;
* 指定 MIME 类型；&lt;br /&gt;
** 默认 MIME 类型为 &amp;lt;code&amp;gt;application/octet-stream&amp;lt;/code&amp;gt;；&lt;br /&gt;
* 指定文件名；&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
示例：&lt;br /&gt;
# 给 HTTP 请求加上标头 Content-Type: multipart/form-data，然后将文件 photo.png 作为 file 字段上传：&lt;br /&gt;
#: &amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot; highlight=&amp;quot;&amp;quot;&amp;gt;&lt;br /&gt;
$ curl -F 'file=@photo.png' https://google.com/profile&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
# 指定 MIME 类型为 image/png：&lt;br /&gt;
#: &amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot; highlight=&amp;quot;&amp;quot;&amp;gt;&lt;br /&gt;
$ curl -F 'file=@photo.png;type=image/png' https://google.com/profile&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
# 原始文件名为 photo.png，但是服务器接收到的文件名为 me.png：&lt;br /&gt;
#: &amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot; highlight=&amp;quot;&amp;quot;&amp;gt;&lt;br /&gt;
$ curl -F 'file=@photo.png;filename=me.png' https://google.com/profile&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== -G ===&lt;br /&gt;
'''-G''' 参数用来'''构造 URL 的查询字符串'''。&lt;br /&gt;
* 如果数据需要 URL 编码，可以结合'''&amp;lt;code&amp;gt;--data--urlencode&amp;lt;/code&amp;gt;'''参数；&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
示例：&lt;br /&gt;
# 发出一个 GET 请求，实际请求的 URL 为“https://google.com/search?q=kitties&amp;amp;count=20”：&lt;br /&gt;
#: &amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot; highlight=&amp;quot;&amp;quot;&amp;gt;&lt;br /&gt;
$ curl -G -d 'q=kitties' -d 'count=20' https://google.com/search&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#* 如果省略 --G，会发出一个 POST 请求。&lt;br /&gt;
# 结合 --data--urlencode 对数据进行 URL 编码：&lt;br /&gt;
#: &amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot; highlight=&amp;quot;&amp;quot;&amp;gt;&lt;br /&gt;
$ curl -G --data-urlencode 'comment=hello world' https://www.example.com&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== -H ===&lt;br /&gt;
'''-H''' 参数'''添加 HTTP 请求的标头'''。&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
示例：&lt;br /&gt;
# 添加 HTTP 标头“Accept-Language: en-US”：&lt;br /&gt;
#: &amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot; highlight=&amp;quot;&amp;quot;&amp;gt;&lt;br /&gt;
$ curl -H 'Accept-Language: en-US' https://google.com&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
# 添加两个 HTTP 标头：&lt;br /&gt;
#: &amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot; highlight=&amp;quot;&amp;quot;&amp;gt;&lt;br /&gt;
$ curl -H 'Accept-Language: en-US' -H 'Secret-Message: xyzzy' https://google.com&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
# 添加 HTTP 请求的标头“Content-Type: application/json”，然后用 '''-d''' 参数发送 JSON 数据：&lt;br /&gt;
#: &amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot; highlight=&amp;quot;&amp;quot;&amp;gt;&lt;br /&gt;
$ curl -d '{&amp;quot;login&amp;quot;: &amp;quot;emma&amp;quot;, &amp;quot;pass&amp;quot;: &amp;quot;123&amp;quot;}' -H 'Content-Type: application/json' https://google.com/login&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== -i ===&lt;br /&gt;
'''-i''' 参数'''打印出服务器回应的 HTTP 标头'''。&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
示例：&lt;br /&gt;
# 收到服务器回应后，先输出服务器回应的标头，然后空一行，再输出网页的源码：&lt;br /&gt;
#: &amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot; highlight=&amp;quot;&amp;quot;&amp;gt;&lt;br /&gt;
$ curl -i https://www.example.com&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== -I ===&lt;br /&gt;
'''-I''' 参数向服务器发出 HEAD 请求，然会将服务器返回的 HTTP 标头打印出来。&lt;br /&gt;
* '''--head''' 参数等同于 '''-I'''；&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
示例：&lt;br /&gt;
# 输出服务器对 HEAD 请求的回应：&lt;br /&gt;
#: &amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot; highlight=&amp;quot;&amp;quot;&amp;gt;&lt;br /&gt;
$ curl -I https://www.example.com&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#: &amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot; highlight=&amp;quot;&amp;quot;&amp;gt;&lt;br /&gt;
$ curl --head https://www.example.com&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== -k ===&lt;br /&gt;
'''-k''' 参数指定'''跳过 SSL 检测'''。&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
示例：&lt;br /&gt;
# 跳过服务器的 SSL 证书检查：&lt;br /&gt;
#: &amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot; highlight=&amp;quot;&amp;quot;&amp;gt;&lt;br /&gt;
$ curl -k https://www.example.com&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== -L ===&lt;br /&gt;
'''-L''' 参数会让 HTTP 请求跟随服务器的重定向。&lt;br /&gt;
* curl 默认不跟随重定向。&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
示例：&lt;br /&gt;
: &amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot; highlight=&amp;quot;&amp;quot;&amp;gt;&lt;br /&gt;
$ curl -L -d 'tweet=hi' https://api.twitter.com/tweet&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== --limit-rate ===&lt;br /&gt;
'''--limit-rate''' 用来限制 HTTP 请求和回应的带宽，模拟慢网速的环境。&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
示例：&lt;br /&gt;
# 将带宽限制在每秒 200K 字节：&lt;br /&gt;
#: &amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot; highlight=&amp;quot;&amp;quot;&amp;gt;&lt;br /&gt;
$ curl --limit-rate 200k https://google.com&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== -o ===&lt;br /&gt;
'''-o''' 参数将服务器的回应保存成文件，等同于'''wget'''命令。&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
示例：&lt;br /&gt;
# 将“www.example.com”保存成“example.html”：&lt;br /&gt;
#: &amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot; highlight=&amp;quot;&amp;quot;&amp;gt;&lt;br /&gt;
$ curl -o example.html https://www.example.com&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== -O ===&lt;br /&gt;
'''-O''' 参数将服务器回应保存成文件，并将 URL 的最后部分当作文件名。&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
示例：&lt;br /&gt;
# 将服务器回应保存成文件，文件名为“bar.html”：&lt;br /&gt;
#: &amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot; highlight=&amp;quot;&amp;quot;&amp;gt;&lt;br /&gt;
$ curl -O https://www.example.com/foo/bar.html&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== -s ===&lt;br /&gt;
'''-s'''参数将不输出错误和进度信息。&lt;br /&gt;
* 一旦发生错误，不会显示错误信息。不发生错误的话，会正常显示运行结果。&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
示例：&lt;br /&gt;
: &amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot; highlight=&amp;quot;&amp;quot;&amp;gt;&lt;br /&gt;
$ curl -s https://www.example.com&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* 如果想让 curl 不产生任何输出，可以使用下面的命令：&lt;br /&gt;
#: &amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot; highlight=&amp;quot;&amp;quot;&amp;gt;&lt;br /&gt;
$ curl -s -o /dev/null https://google.com&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== -S ===&lt;br /&gt;
'''-S''' 参数指定只输出错误信息，通常与'''-s'''一起使用。&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
示例：&lt;br /&gt;
# 除非发生错误，否则没有任何输出：&lt;br /&gt;
#: &amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot; highlight=&amp;quot;&amp;quot;&amp;gt;&lt;br /&gt;
$ curl -s -o /dev/null https://google.com&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== -u ===&lt;br /&gt;
'''-u''' 参数用来设置服务器认证的'''用户名和密码'''。&lt;br /&gt;
* curl 能够识别 URL 里面的用户名和密码。&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
示例：&lt;br /&gt;
# 设置用户名为 bob，密码为 12345，然后将其转为 HTTP 标头“Authorization: Basic Ym9iOjEyMzQ1”：【？？？】&lt;br /&gt;
#: &amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot; highlight=&amp;quot;&amp;quot;&amp;gt;&lt;br /&gt;
$ curl -u 'bob:12345' https://google.com/login&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
# 识别 URL 里面的用户名和密码，将其转为上个例子里面的 HTTP 标头：&lt;br /&gt;
#: &amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot; highlight=&amp;quot;&amp;quot;&amp;gt;&lt;br /&gt;
$ curl https://bob:12345@google.com/login&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
# 只设置用户名，执行后，curl 会提示用户输入密码：&lt;br /&gt;
#: &amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot; highlight=&amp;quot;&amp;quot;&amp;gt;&lt;br /&gt;
$ curl -u 'bob' https://google.com/login&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== -v ===&lt;br /&gt;
'''-v''' 参数输出通信的整个过程，用于调试。&lt;br /&gt;
* --trace参数也可以用于调试，还会输出原始的二进制数据。&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
示例：&lt;br /&gt;
: &amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot; highlight=&amp;quot;&amp;quot;&amp;gt;&lt;br /&gt;
$ curl -v https://www.example.com&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
: &amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot; highlight=&amp;quot;&amp;quot;&amp;gt;&lt;br /&gt;
$ curl --trace - https://www.example.com&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== -x ===&lt;br /&gt;
'''-x'''参数指定 HTTP 请求的'''代理'''。&lt;br /&gt;
* 如果没有指定代理协议，默认为 '''HTTP'''。&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
示例：&lt;br /&gt;
# 指定 HTTP 请求通过“myproxy.com:8080”的 socks5 代理发出：&lt;br /&gt;
#: &amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot; highlight=&amp;quot;&amp;quot;&amp;gt;&lt;br /&gt;
$ curl -x socks5://james:cats@myproxy.com:8080 https://www.example.com&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
# 如下请求的代理使用 HTTP 协议：&lt;br /&gt;
#: &amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot; highlight=&amp;quot;&amp;quot;&amp;gt;&lt;br /&gt;
$ curl -x james:cats@myproxy.com:8080 https://www.example.com&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== -X ===&lt;br /&gt;
'''-X''' 参数'''指定 HTTP 请求的方法'''。&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
示例：&lt;br /&gt;
# 对“https://www.example.com”发出 POST 请求：&lt;br /&gt;
#: &amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot; highlight=&amp;quot;&amp;quot;&amp;gt;&lt;br /&gt;
$ curl -X POST https://www.example.com&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;</summary>
		<author><name>Eijux</name></author>
	</entry>
</feed>