Hi,

I know that this is not really an android question but i am new to
both android and JSON.

{"Email":"[email protected]","Password":"123456"} to a url.

The above structure is sent to Server in a variable named “json”. The
server reads the data and sends back the user information in a json
object if the login is successful or {"error","-1"} if the
authentication fails.

try
{
JSONObject json=new JSONObject();
json.put("email", "[email protected]");
json.put("password", "arslan");
HttpParams p=new BasicHttpParams();
p.setParameter("json", json.toString());
HttpClient client = new DefaultHttpClient(p);
HttpResponse response=client.execute(new HttpGet("http://www.abc/
getuserdetails"));
InputStream is=response.getEntity().getContent();
String a=convertStreamToString(is);
Log.i("Read from the server", a);
}
catch(Exception e)
{}

But this isnt worrking. What am i doing wrong ? If anybody has some
working code that they could share with me i would be very grateful. I
have been stuck with this for the past 24 hours and tried everything
under the sun. At the last line the string a should contain a jason
string contain the user attributes for [email protected].

Could any one help me ?

Kind Regards,

Mateen

-- 
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

Reply via email to