2015年3月16日 星期一

API POST傳值

List nvps = new ArrayList();
//new BasicNameValuePair(key, value)
nvps.add(new BasicNameValuePair("source", "1"));
nvps.add(new BasicNameValuePair("pinstr", "10"));
nvps.add(new BasicNameValuePair("pinend", "50"));

HttpClient mHttpClient = new DefaultHttpClient();
HttpPost httpPost = new HttpPost(url);
httpPost.setEntity(new UrlEncodedFormEntity(nvps, "UTF-8"));
HttpResponse mHttpResponse = mHttpClient.execute(httpPost);
      

沒有留言:

張貼留言