1

I want to add NameValuePairs to an HttpPost that calls a php-script (to query a database).

Here's what I've tried:

ArrayList<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>();
nameValuePairs.add(new BasicNameValuePair("w", "(id='1a')"));
HttpPost httpPost = new HttpPost("http://www.mysite.tv/getList.php");
UrlEncodedFormEntity requestEntity = new UrlEncodedFormEntity(nameValuePairs);             
httpPost.addHeader(requestEntity.getContentType());
httpPost.setEntity(requestEntity);
HttpResponse response = httpClient.execute(httpPost);

I expect to only get the element with id=1a but the script returns all elements. If I call the php like that:

HttpPost httpPost = new HttpPost("http://www.mysite.tv/getList.php?w=(id='1a')");

It works perfectly fine.

Am I doing something wrong when setting the NameValueParis? Any ideas? Thanks in advance

Androidicus
  • 1,688
  • 4
  • 24
  • 36

0 Answers0