BasicNetwork.performRequest: Unexpected response code 403 for http://localhost/database/login.php

android, android-volley, php

Solution

First check if you can open the same url on your mobile browser. I assume you use Apache2.4.9 webserver. If you've not changed default values for you get "denied permission". To solve this problem you need change some values in "httpd.conf" file which has Apache settings.

1- Under DocumentRoot change Directory xml tag as following:

<Directory />
     AllowOverride none
     Require all granted
</Directory>

2- Under "onlineoffline tag" update the line as following:

<Directory />
    ...
    ...
    ...
#   onlineoffline tag - don't remove
    Require all granted
</Directory>

Note: If you use older version of Apache you need google for right syntax in httpd.conf

Let me know if this changes work or not. :)

Problem

I am using Volley to connect to MySql database. I created the database tables and wrote the php function and below is the java code. All this was working all along but just yesterday it woke up giving this error in the logcat and its not returning any response, testing the php script using google chrome postman works just fine so im thinking there is something wrong in my java code. BasicNetwork.performRequest: Unexpected response code 403 for http://192.168.43.71/database/login.php I know several questions like this have been asked before, i have gone through them all and nothing seems to work at all. I am going nuts. ``` private void login() { StringRequest jsonObjRequest = new StringRequest(Method.POST, Constants.ACCOUNTLOGIN, loginSuccessListener(), loginErrorListener()) { protected Map<String, String> getParams() throws com.android.volley.AuthFailureError { Map<String, String> params = new HashMap<String, String>(); params.put("user_phone_number", sPhoneNumber); params.put("user_password", sPassword); return params; }; }; mVolleyQueue.add(jsonObjRequest); } ```

Original source

Related problems