I have this error:
Volley: [8918] BasicNetwork.performRequest: Unexpected response code 403 for
I'm trying to connect in the serve,r but I can't retrieve anything. When I tried it in a localhost server, it works perfectly.
I have this error:
Volley: [8918] BasicNetwork.performRequest: Unexpected response code 403 for
I'm trying to connect in the serve,r but I can't retrieve anything. When I tried it in a localhost server, it works perfectly.
Solution worked for me:
Check is that link works in browser.
If yes then, add Header User-Agent: "Mozilla/5.0"
to your requests. Sending header example in Stackoverflow
Sory for my bad english
in C:\wamp64\bin\apache\apache2.4.23\conf\extra\httpd-vhosts.conf
change
require local
to
Require all granted
The 403 Forbidden error is an HTTP status code which means that accessing the page or resource you were trying to reach is absolutely forbidden for some reason.
Make sure you are accessing the correct url.
This is for Headers If You Needed
@Override
public Map<String, String> getHeaders() throws AuthFailureError {
Map<String, String> params = new HashMap<String, String>();
params.put("Content-Type", "application/json; charset=UTF-8");
params.put("Access Token", token);
return params;
}
I hope this helps
I got this error when I run my application on the built-in emulator of Android Studio. But when I changed the emulator and used Genymotion, the problem was solved and the application run without any errors.
I have also faced the same problem and i have solve it by changing the method name. previously i am try to calling web service with POST method and i have changed to GET method then my problem solved. Try this solution by changing request method.
StringRequest stringRequest = new StringRequest(Request.Method.GET, "YOUR_WEBSERVICE_URL",
new Response.Listener<String>() {
@Override
public void onResponse(String response){}
},
new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError volleyError) {}
}) {
@Override
protected Map<String, String> getParams()
{
Map<String, String> params = new HashMap<String, String>();
return params;
}
};
stringRequest.setRetryPolicy(new DefaultRetryPolicy(60000,DefaultRetryPolicy.DEFAULT_MAX_RETRIES, DefaultRetryPolicy.DEFAULT_BACKOFF_MULT));
RequestQueue requestQueue = Volley.newRequestQueue(getActivity());
requestQueue.add(stringRequest);
© 2022 - 2024 — McMap. All rights reserved.