Hi, I want to submit a form from within my app. The form can be found here
>> http://customer.chuckwilson.com/Default.aspx
I have added all the parameters, but the request is not going through. I
keep getting the form as the response. What am I doing wrong here? My code
is below:
try {
HttpClient client = new DefaultHttpClient();
String postURL = "http://customer.chuckwilson.com/Default.aspx";
HttpPost post = new HttpPost(postURL);
List<NameValuePair> nameValuePairs = new
ArrayList<NameValuePair>();
nameValuePairs.add(new BasicNameValuePair("txtFirstName",
"android"));
nameValuePairs.add(new BasicNameValuePair("txtEmailAddress", "
[email protected]"));
nameValuePairs.add(new BasicNameValuePair("txtStreetAddress",
"streetandroid"));
nameValuePairs.add(new BasicNameValuePair("txtZipCode", "5454"));
nameValuePairs.add(new BasicNameValuePair("txtCity", "cityandroid"));
nameValuePairs.add(new BasicNameValuePair("CallBack", "rdCallBackYes"));
nameValuePairs.add(new BasicNameValuePair("txtLastName",
"lastandroid"));
nameValuePairs.add(new BasicNameValuePair("phone", "(111)111-1111"));
UrlEncodedFormEntity ent = new
UrlEncodedFormEntity(nameValuePairs,HTTP.UTF_8);
post.setEntity(ent);
HttpResponse responsePOST = client.execute(post);
HttpEntity resEntity = responsePOST.getEntity();
if (resEntity != null) {
Log.i("RESPONSE",EntityUtils.toString(resEntity));
}
} catch (Exception e) {
e.printStackTrace();
}
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en