curl 指令发起 post请求

curl 指令发起 post请求


1.To upload a file via curl:

curl http://api.example.com/profile -F "image=@profile.jpg"

2.In php this will give you the profile.jpg in the $_FILES['image'], now to add additional field values you just add additional -F arguments like this:

curl http://api.example.com/profile -F "image=@profile.jpg" -F "phone=123456789"
3.To post simple field/value:

curl http://api.example.com/profile -d "phone=123456789&name=Hwei"


版权声明:本文为caox_nazi原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。