创建网络请求
Windows
、 Linux
和 Mac
上皆可使用一个简单的 POST 请求
-X
:指定与远程服务器通信时将使用哪种 HTTP 请求方法curl -X POST http://example.com
POST 请求传递数据
-d
:设置请求参数(拼接参数或json)curl -X POST http://example.com -d "firstname=John&lastname=Andrew"
-H
:设置request里的headercurl -X POST http://example.com -d '{"hello": "world"}' -H 'Content-Type: application/json'
-F
:模拟HTTP表单数据提交 multipart POSTcurl -X POST http://example.com -F 'name=Jason' -F 'email=jason@example.com'
带参数请求,参数用&连接
curl http://127.0.0.1:8080/login?admin&passwd=12345678
请求头
和请求体
都包含了