返回顶部

收藏

java 发起http post请求

更多
/**
     * 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;
    }

标签:java,http

收藏

0人收藏

支持

0

反对

0

发表评论