curl 简单使用
部分参数
-d, --data <data>POST的包体-H, --header <header>包头-w, --write-out <format>耗时时间-X, --request发送方式(POST、PUT)
举例
POST application/x-www-form-urlencoded
curl -d "param1=value1¶m2=value2" -X POST http://localhost:8080/hello curl -d "param1=value1¶m2=value2" -H "Content-Type: application/x-www-form-urlencoded" -X POST http://localhost:8080/hello #使用文件 curl -d "@../data/cats.txt" -X POST http://localhost:8080/hello
POST application/json
curl -d '{"key1":"value1", "key2":"value2"}' -H "Content-Type: application/json" -X POST http://localhost:8080/hello
curl -d "@../data/cats.txt" -X POST http://localhost:8080/hello测试访问支付宝首页
# 环境
$ lsb_release -a
LSB Version: :base-4.0-amd64:base-4.0-noarch:core-4.0-amd64:core-4.0-noarch
Distributor ID: CentOS
Description: CentOS release 6.5 (Final)
Release: 6.5
Codename: Final
# 测试
$ curl -w "TCP handshake: %{time_connect}, SSL handshake: %{time_appconnect}\n" -so /dev/null https://www.alipay.com
TCP handshake: 0.141, SSL handshake: 0.435参考
相关推荐
曾是土木人 2020-10-31
yegen00 2020-10-21
soralaro 2020-10-11
katanaFlower 2020-09-18
wytzsjzly 2020-08-17
88407710 2020-08-17
ChinaJoeEE 2020-08-16
CyborgLin 2020-08-15
Blueberry 2020-08-15
PinkBean 2020-08-11
katanaFlower 2020-08-03
hunningtu 2020-07-30
阿债的方寸天地 2020-06-28
pingyan 2020-06-25
wytzsjzly 2020-06-25
阳光岛主 2020-06-25
阿债的方寸天地 2020-06-16