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; 
    }

原创文章,作者:奋斗,如若转载,请注明出处:https://blog.ytso.com/10433.html

(0)
上一篇 2021年7月19日
下一篇 2021年7月19日

相关推荐

发表回复

登录后才能评论