• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps sending POST to server problem

ezekel

Newbie
Hi, I need your help please ever time I send data to my mysql database the posted data is empty...I don't know what is wrong with my code.

[HIGH]urlConnection = (HttpURLConnection) url.openConnection();
urlConnection.setRequestMethod("POST");
urlConnection.setDoOutput(true);

urlConnection.setChunkedStreamingMode(0);

OutputStream out = new BufferedOutputStream(urlConnection.getOutputStream());

nameValuePairs = new ArrayList<NameValuePair>(2);
nameValuePairs.add(new BasicNameValuePair("username",adduser.getText().toString()));
nameValuePairs.add(new BasicNameValuePair("password",addpass.getText().toString()));

out.write(nameValuePairs.toString().getBytes());[/HIGH]
 
Back
Top Bottom