Home
Linux
Golang
MySQL
PHP
Other
curl 命令行 post请求
创建日期:2019-09-02 15:52:58
更新日期:2023-02-06 17:08:40
栏目:
PHP
浏览:542
POST请求 : 请求地址:www.shuxiaoyuan.com/index.php/Api/index/test 请求方式:POST 请求参数: | 参数 |类型 |说明 | | :------------: | :------------: | :------------: | | phone | string | 手机号 | | password | string | 密码 | | app_key | string | app_key | | token | string | token值 | ``` curl -d "phone=13311939117&password=123456&app_key=8d49f16fe034b98b&token=JSIKW220KGDBWWMSKWI" "http://www.shuxiaoyuan.com/index.php/Api/index/test" ``` 发送文件 通过脚本发送post请求,顺便附带文本数据,比如通过"浏览"选择本地的card.txt并上传发送post请求 ``` curl -F "blob=@card.txt;type=text/plain" "http://172.16.102.208:8089/wiapi/score?leaderboard_id=7778a8143f111272&score=40&app_key=8d49f16fe034b98b&_test_user=test01" ``` 其中-F 为带文件的形式发送post请求, blob为文本框中的name元素对应的属性值。<type="text" name="blob"> 带请求头 ``` curl -X POST -d '{"param1":"","param2":"6178617811022883","param3":"213465"}' -H 'header1:abc' -H 'header2:1607957421532' -H 'Content-Type:application/json;chartset=uft-8' http://xxx.com ``` ## 附录 - 参考地址:http://www.ruanyifeng.com/blog/2019/09/curl-reference.html
内容版权声明:本文为舒孝元原创文章,转载无需和我联系,但请注明来自
舒孝元博客:https://www.shuxiaoyuan.com/info/15
联系邮箱:sxy@shuxiaoyuan.com