boilerpipe icon indicating copy to clipboard operation
boilerpipe copied to clipboard

Server returned HTTP response code: 403 for URL (SOLVED) please use this codeline.

Open GoogleCodeExporter opened this issue 9 years ago • 2 comments

Instead of using URLConnection in java, if you use HttpURLConnection
we can able to access the requested web page from java.
Try the following code

HttpURLConnection httpcon = (HttpURLConnection) url.openConnection();
httpcon.addRequestProperty("User-Agent", "Mozilla/4.76");

Normal java using urlConnection wont accept to access the internet.
If access the browser it will allow to perform a search
without this exception "HTTP response code : 403 for URL"
exception caused:
de.l3s.boilerpipe.BoilerpipeProcessingException: java.io.IOException:
Server returned HTTP response code: 403 for URL:
http://petapixel.com/2013/05/13/sony-xperia-zr-smartphone-doubles-as-an-underwat
er-camera/

After these changes it's working fine now.

The changes was done in de.l3s.boilerpipe.sax.HTMLFetcher.java at
public static HTMLDocument fetch(final URL url) method

Please cite my name in the code and changes list.
Daniel da Silva Souza, University of Brasilia (UnB), Brazil.

Best Regards,
Daniel Souza

Original issue reported on code.google.com by [email protected] on 5 Oct 2013 at 2:37

Attachments:

GoogleCodeExporter avatar Mar 24 '15 10:03 GoogleCodeExporter

Thank's it works !! 

Original comment by [email protected] on 8 Jul 2014 at 2:50

GoogleCodeExporter avatar Mar 24 '15 10:03 GoogleCodeExporter

It seems that the project was discontinued, but I'm glad to help you.

Regards,
Daniel Souza.

Original comment by [email protected] on 8 Jul 2014 at 5:47

GoogleCodeExporter avatar Mar 24 '15 10:03 GoogleCodeExporter