`

使用curl和wget发送post请求

 
阅读更多

转于:

http://blog.csdn.net/cws1214/article/details/21440691

 

--------------------------------------------------------------------------------

 

1.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] => 投票

)

 

 

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics