0

I am working on a simple http based application for android.

I have login.php at a server and i am sending requests to it with the following values.

Uri.Builder loginUri =Uri.parse(LOGIN_API_URL).buildUpon();
loginUri.appendQueryParameter("username", username);
loginUri.appendQueryParameter("password", "FXK3guidUGU=");
aQuery.ajax(loginUri.build().toString(), JSONObject.class,loginResponse);

The requests goes fine, but the PHP code receives password as FXK3guidUGU. Probably because of the equals(=) character. How do i ensure PHP receives the password inclusive of the equals(=) character?

Here is my PHP code that filters the password:

$password = filter_input(INPUT_GET, 'password', FILTER_SANITIZE_SPECIAL_CHARS);

Thanks for your help.

nmvictor
  • 1,109
  • 1
  • 15
  • 30

1 Answers1

1

try to use URLEncoder

Uri.Builder loginUri =Uri.parse(LOGIN_API_URL).buildUpon();
loginUri.appendQueryParameter("username", username);
loginUri.appendQueryParameter("password", URLEncoder.encode("FXK3guidUGU=", "UTF-8"));
aQuery.ajax(loginUri.build().toString(), JSONObject.class,loginResponse);
  • @nmvictor: Suggest the edits to the author of the answer or if needed, come up with your own answer. Your edit was "putting words into his mouth" which is generally not approved. – tmt Mar 25 '15 at 11:48
  • Sorry, i dint mean so. Only meant to improve the answer. Anyways, i accepted the answer and thanks all. – nmvictor Mar 26 '15 at 20:06