GO HERE FOR MORE INFO ABOUT POST-GET
http://www.vogella.com/tutorials/ApacheHttpClient/article.html
How_To_Make_HTTP_POST_Request_To_Server_-_Android_Example IMPORTANT!!!
//for registerhttps://te
HttpPost httppost = new HttpPost("url here");
//add data
try{
List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(7);
nameValuePairs.add(new BasicNameValuePair("firstname", "harsh"));
nameValuePairs.add(new BasicNameValuePair("lastname", "chandel"));
nameValuePairs.add(new BasicNameValuePair("email", "mike.bulurt66@gmail.com"));
nameValuePairs.add(new BasicNameValuePair("phone", "944566778"));
nameValuePairs.add(new BasicNameValuePair("username", "mikebulurt"));
nameValuePairs.add(new BasicNameValuePair("password", "qwert"));
nameValuePairs.add(new BasicNameValuePair("device_duid", "986409987"));
//add data
httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));
// Execute HTTP Post Request
HttpResponse response = httpclient.execute(httppost);
InputStream in = response.getEntity().getContent();
StringBuilder stringbuilder = new StringBuilder();
BufferedReader bfrd = new BufferedReader(new InputStreamReader(in),1024);
String line;
while((line = bfrd.readLine()) != null)
stringbuilder.append(line);
downloadedString = stringbuilder.toString();
} catch (ClientProtocolException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
System.out.println("downloadedString:in login:::"+downloadedString);
return downloadedString;
No comments:
Post a Comment