When I fetch data from an URL with a 403 response
is = conn.getInputStream();
It throws an IOException and I can't get the response data.
But when I use firefox and access that url directly, The ResponseCode is still 403, but I can get the html content
The HttpURLConnection.getErrorStream
method will return an InputStream
which can be used to retrieve data from error conditions (such as a 404), according to the javadocs.
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