用curl命令上传文件和以post方式发请求

To upload a file via curl:

curl http://api.example.com/profile -F "[email protected]"
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 "[email protected]" -F "phone=123456789"
To post simple field/value:
curl http://api.example.com/profile -d "phone=123456789&name=Hwei"

你可能感兴趣的:(Linux)