phpandroidhttpaquery

Send Query parameter value containing equals(=) character


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.


Solution

  • 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);