| 注册
请输入搜索内容

热门搜索

Java Linux MySQL PHP JavaScript Hibernate jQuery Nginx
SamiraLedbe
10年前发布

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