已复制到剪贴板

curl

`curl` 是一个命令行工具,用于发送和接收网络请求。它支持多种协议,包括 HTTP、FTP 和 SMTP,并且可以在终端中直接运行。 `curl` 通常用于从命令行下载文件或与 API 交互。
例如:http://example.com

例子

  • 发送 GET 请求并在终端中显示响应:
curl <http://example.com>
  • 发送 POST 请求并在终端中显示响应:
curl -X POST <http://example.com> --data "param1=value1&param2=value2"
  • 下载文件并保存到本地文件:
curl -o filename.txt <http://example.com/file.txt>
  • 设置请求头:
curl -H 'Content-Type: application/json' <http://example.com>
  • 使用代理服务器发送请求:
curl -x <http://proxy-server>:port <http://example.com>