Hey, I'm working on an app for my final year project in college and something I'm struggling with is trying to use the default http client to mimic the below post, as it seems different in format to the others I have seen. The code I'm using it similar to this and has been successful at logging onto the site:
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();
}
However, I'm struggling to distinguish parameters and their values from the below post and am unsure of the purpose of the number 8743499427392. Any help would be much appreciated:
(part of the post from 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--