android http post response format type different than specified in query string
<p>I am sending post request from android to the url using httpclient like this one below - </p>

<p>String url = "http://www.myurl.com/test.php?format=json";</p>

<p>Now I am getting response back in form of plist instead of json, which is default type of response from php file if no format query string is described in url.</p>

<p>Can we specify query string in url while posting? It looks like php file is not getting format query string.</p>

<pre><code>List&lt;NameValuePair&gt; nameValuePairs = new ArrayList&lt;NameValuePair&gt;();
nameValuePairs.add(new BasicNameValuePair("method", "add"));
nameValuePairs.add(new BasicNameValuePair("device_id", "123"));
nameValuePairs.add(new BasicNameValuePair("device_token", "3221"));
nameValuePairs.add(new BasicNameValuePair("session_id", "1212"));
nameValuePairs.add(new BasicNameValuePair("event_id","12345" ));

HttpClient httpclient = new DefaultHttpClient();
HttpPost httppost = new HttpPost(url);                      httppost.addHeader("Content-Type","application/x-www-form-urlencoded");
httppost.addHeader("Accept","application/json");
httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs, HTTP.UTF_8));
HttpResponse response = httpclient.execute(httppost);

/* Checking response */
if (response != null) {
     InputStream in = response.getEntity().getContent();
     String a = convertStreamToString(in);
    Log.i("Read from Server "+response.getStatusLine().getStatusCode(), a);
}else{
    Log.i("response is ", "null");

}
</code></pre>

<p>Thanks</p>
