jikkujose / boilerpipe

Automatically exported from code.google.com/p/boilerpipe
0 stars 0 forks source link

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

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
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 dssouzadan@gmail.com on 5 Oct 2013 at 2:37

Attachments:

GoogleCodeExporter commented 9 years ago
Thank's it works !! 

Original comment by sal...@gmail.com on 8 Jul 2014 at 2:50

GoogleCodeExporter commented 9 years ago
It seems that the project was discontinued, but I'm glad to help you.

Regards,
Daniel Souza.

Original comment by dssouzadan@gmail.com on 8 Jul 2014 at 5:47