java 发起http post请求

2018-07-20    来源:open-open

容器云强势上线!快速搭建集群,上万Linux镜像随意使用
/**
     * Creates the request "https://www.mycallaccount.com/ot/triggerID1.asp".
     * Customer didn't provide public API for this service. Used Fiddler2 to
     * grab data and emulate request through browser
     * 
     * @param callbackNumber
     *            callback number
     * @return the http post
     */
    private HttpPost createRequestToMycallaccountSite(String callbackNumber) {
        String value = String.format(
                "Did=%s&Password=%s&LegBPhone=%s&tempCB=%s&B1=Trigger",
                mSettings.getLogin(), mSettings.getPassword(),
                Uri.encode(mDialingContact.getNumber()),
                Uri.encode(callbackNumber));
        HttpPost post = new HttpPost(
                "https://www.mycallaccount.com/ot/Di_Trigger_Now31.asp");
        ByteArrayEntity entity = new ByteArrayEntity(value.getBytes());
        post.addHeader("Content-Type", "application/x-www-form-urlencoded");
        post.setEntity(entity);
        return post;
    }

标签:

版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com
特别注意:本站所有转载文章言论不代表本站观点!
本站所提供的图片等素材,版权归原作者所有,如需使用,请与原作者联系。

上一篇:HtmlUnit 模拟浏览器以及Cookie使用示例

下一篇:php透明水印生成