mysql json curl_curl post传递json数据

有时想在命令行使用post

http提交一个表单,比较常用的是POST模式和GET模式

GET模式什么option都不用,只需要把变量写在url里面就可以了

比如:curl http://www.waynerQiu.com/login.cgi?user=nickwolfe&password=12345

而POST模式的option则是 -d (--data

-d/--data

(HTTP) Sends the specified data in a POST request to the HTTP

server, in the same way that a browser does when a user has filled

in an HTML form and presses the submit button. This will cause curl

to pass the data to the server using the content-type >application/x-

www-form-urlencoded.

比如,curl -d "user=nickwolfe&password=12345" http://www.waynerQiu.com/login.cgi

就相当于向这个站点发出一次登陆申请;

到底该用GET模式还是POST模式,要看对面服务器的程序设定。

curl --data "data=xxx" example.com/form.cgi

如果你的数据没有经过表单编码,还可以让curl为你编码,参数是--data-urlencode。

curl --data-urlencode "date=April 1" example.com/form.cgi

一点需要注意的是,POST模式的文件上传,比如

action="http://... /~zzh/up_file.cgi">

这样一个HTTP表单,我们要用curl进行模拟,就该是这样的语法:

curl -F upload=@localfile -F nick=go http://.../~zzh/up_file.cgi

11)https的时候使用本地证书,可以使用option:-E

curl -E localcert.pem https://remote_server

更多:

http://www.dewen.org/q/3803/%E5%9C%A8linux%E5%91%BD%E4%BB%A4%E8%A1%8C%E4%B8%8Bcurl+%E6%8F%90%E4%BA%A4json%E6%95%B0%E6%8D%AE%E7%9A%84%E9%97%AE%E9%A2%98

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值