ねえ、私は大学の最終学年のプロジェクトのアプリに取り組んでいます。私が苦労しているのは、デフォルトのhttpクライアントを使用して、以下の投稿を模倣しようとしています。これは、他の投稿とは形式が異なるようです。私が使用しているコードはこれに似ており、サイトへのログオンに成功しています。
HttpClient httpclient = new DefaultHttpClient();
HttpPost httppost = new HttpPost("http://www.myurl.com/app/page.php");
// Add your data
List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(5);
nameValuePairs.add(new BasicNameValuePair("type", "20"));
nameValuePairs.add(new BasicNameValuePair("mob", "919895865899"));
nameValuePairs.add(new BasicNameValuePair("pack", "0"));
nameValuePairs.add(new BasicNameValuePair("exchk", "1"));
try {
httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));
Log.d("myapp", "works till here. 2");
try {
HttpResponse response = httpclient.execute(httppost);
Log.d("myapp", "response " + response.getEntity());
} catch (ClientProtocolException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
ただし、パラメータとその値を以下の投稿と区別するのに苦労しており、番号8743499427992の目的がわかりません。ご協力いただければ幸いです。
(Http Live Headersからの投稿の一部)
http://messaging.o2online.ie/con_save.osp
POST /con_save.osp -----------------------------8743499427392
Content-Disposition: form-data; name="EContactID"
-1^
-----------------------------8743499427392
Content-Disposition: form-data; name="EContactIDList"
-----------------------------8743499427392
Content-Disposition: form-data; name="Categories"
Synch;
-----------------------------8743499427392
Content-Disposition: form-data; name="ENickName"
Test Colm Test Shannon
-----------------------------8743499427392
Content-Disposition: form-data; name="EAtt1"; filename=""
Content-Type: application/octet-stream
-----------------------------8743499427392
Content-Disposition: form-data; name="EPMobile"
0868617541
-----------------------------8743499427392
Content-Disposition: form-data; name="EMobile"
-----------------------------8743499427392--