curl的常用命令
apt install curl
curl www.baidu.com
curl 命令行浏览器式的浏览器
| 参数 | 说明 | 示例 |
|---|---|---|
| -a | 设置user-agent | curl -a “Chrome” https://www.baidu.com |
| -X | 用制定方法请求 | curl -X post http://httpbin.org/post |
| -I | 只返回请求的头信息 | curl -I http://baidu.com |
| -d | 以post方法请求URL,并发送相应的参数 | curl -d test=123 http://httpbin.org/post curl -d “a=1&b=2&c=3” http://httpbin.org/post curl -d a=1 -d b=2 -d c=3 http://httpbin.org/post 也可以使用文件写入 |
| -O | 下载文件并以远程的文件名保存 | curl -O http://httpbin.org/image/jpeg |
| -o | 下载文件设置自己的名字保存 | curl -o fox.jpeg http://httpbin.org/image/jpeg |
| -L | 跟随重定向请求 | curl -IL https://baidu.com |
| -H | 设置头信息 | |
| -k | 允许发起不安全的SSL请求 | curl -Lk https://www.12306.cn |
| -b | 设置cookies | curl -b a=test http://httpbin.org/cookies |
本文来自博客园,作者:{Zeker62},转载请注明原文链接:https://www.cnblogs.com/Zeker62/p/15046226.html

浙公网安备 33010602011771号