2

when i try to connect (i want parse some site) with proxy, i get Document (i use jsoup) like:

 <html>
 <head></head>
 <body>
  HTTP/1.1 400 Bad Request 
 </body>
</html>

here is my code in java:

String startUrl = "http://mp3u.club/novye_pesni";
        List<MusicElement> musicElements = new LinkedList<>();
        //System.setProperty("http.proxyHost", "139.59.72.192");
       // System.setProperty("http.proxyPort", "3128");
        Document document = Jsoup.connect(startUrl)
                .proxy("139.59.72.192",3128)
                .userAgent("Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.4; en-US; rv:1.9.2.2) Gecko/20100316 Firefox/3.6.2") 
                .header("Content-Language", "en-US") 
                .get();
        Elements songContent = document.getElementsByClass("song-title");

And yeah, i try connect with "System.setProperty" but got the same document. If i connect without proxy it`s working. How can i connect with proxy and without "400 bad request". P.S. Sorry for my disgusting English.

GolamMazid Sajib
  • 8,698
  • 6
  • 21
  • 39
Anton Mironov
  • 83
  • 2
  • 7
  • Please see: https://stackoverflow.com/questions/6341602/httpurlconnection-get-request-getting-400-bad-request – Stephan Dec 14 '17 at 19:41

0 Answers0