我正在从我的 android AVD 执行 HttpPost,如下所示...
// Create a new HttpClient and Post Header
HttpClient httpclient = new DefaultHttpClient();
HttpPost httppost = new HttpPost("http://www.yoursite.com/api/GETTrafficDirector");
HttpResponse response = null;
try {
// Add your data
List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>();
nameValuePairs.add(new BasicNameValuePair("id", "12345"));
nameValuePairs.add(new BasicNameValuePair("stringdata", "AndDev is Cool!"));
httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));
// Execute HTTP Post Request
response = httpclient.execute(httppost);
}
帖子执行时我正在运行 Fiddler,但 Fiddler 中没有任何反应。Fiddler不应该抓住这个帖子吗?我希望检查实体内容,因为 Eclipse 中的显示很难阅读。谢谢,加里