我想使用一些参数访问API, 这下面我做了什么。但是它仍然不起作用,我不知道要解决这种情况,发送XML参数值所需的API必须经过HTML编码,
我曾尝试运行和调试此代码,但指针堆栈位于“ HttpResponse”部分。
HttpClient httpclient = new DefaultHttpClient();
HttpPost httppost = new HttpPost("URL.php");
try {
// Add your data
List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(6);
nameValuePairs.add(new BasicNameValuePair("Username", "pr_demo"));
nameValuePairs.add(new BasicNameValuePair("Password", "WU6xxxxxxx1PV"));
nameValuePairs.add(new BasicNameValuePair("msg_type", "txt"));
nameValuePairs.add(new BasicNameValuePair("Msisdn", "Phone Numb"));
nameValuePairs.add(new BasicNameValuePair("msisdn_sender", "ProMDemo"));
nameValuePairs.add(new BasicNameValuePair("Message", "Hiii---"));
nameValuePairs.add(new BasicNameValuePair("dr_url", "stardeptstore.com"));
httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));
// Execute HTTP Post Request
HttpResponse response = httpclient.execute(httppost);
} catch (ClientProtocolException e) {
// TODO Auto-generated catch block
} catch (IOException e) {
// TODO Auto-generated catch block
}