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);
}
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. :)
BasicNetwork.performRequest: Unexpected response code 403 for http://localhost/database/login.php
Here is the problem in the URL, use your system IP where you hosted your web services and disable firewall, antivirus that may sometimes block to access your system services from other.
It may your IP address has changed, confirm it again. Service URL format would be something like http://your_system_ip_address/database/login.php
Please check :
I think it will help.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With