使用curl和wget发送post请求

wget

wget --post-data="user=user1&pass=pass1&submit=Login" http://domain.com/path/page_need_login.php

2.curl (可直接发送格式化请求例如json)

提交json数据需要加header,否则需'json={"phone":"13521389587","password":"test"}’

curl -H "Content-type: application/json" -X POST -d '{"phone":"13521389587","password":"test"}' http://domain/apis/users.json

普通请求

curl $URL -d "2880[]=105&pid=2880&p=最佳&count=1&receipt=1&poll=投票"

结果

Array

(

[2880] => Array

    (

        [0] => 105

    )


[pid] => 2880

[p] => 最佳

[count] => 1

[receipt] => 1

[poll] => 投票

)

你可能感兴趣的:(使用curl和wget发送post请求)