Jsoup 解决访问认证问题

String username = "foo";
String password = "bar";
String login = username + ":" + password;
String base64login = new String(Base64.encodeBase64(login.getBytes()));

Document document = Jsoup
    .connect("http://example.com")
    .header("Authorization", "Basic " + base64login)
    .get();

  

posted on 2015-07-15 16:34  IT Ⅳ  阅读(1006)  评论(0编辑  收藏  举报

导航