使用curl发送请求
作者:
好多可乐 | 来源:发表于
2021-11-14 22:37 被阅读0次
一、curl常见用法
- url=http://www.baidu.com
- get请求:curl $url
- post请求:curl -d 'xxx' $url
- proxy使用:curl -x 'http://127.0.0.1:8080' $url (引号内内容表示代理地址)
二、重要参数
|
|
| 参数 |
含义 |
| -H ’Content-type:application/json' |
消息头设置(重要) |
| -u username:password |
用户认证,包括token认证之类的 |
| -d |
要发送的post数据 @file 表示来自于文件 |
| --data -urlencode ‘page_size=50’ |
对内容进行url编码 |
| -G |
把data数据当成get请求的参数发送,常与--data -urlencode结合使用(post转为get时候使用) |
| -o |
写文件,通常用于下载 |
| -x |
代理http代理 socks5代理 |
| -v berbose |
打印更详细的日志 |
| -s |
关闭一些提示输出 |
更多示例介绍:
https://home.testing-studio.com/t/topic/1065
本文标题:使用curl发送请求
本文链接:https://www.haomeiwen.com/subject/iecftrtx.html
网友评论