jsoup 使用总结1--添加header

大部分时候,我们使用jsoup解析网页的是否都是直接Jsoup.connect(url); 孰不知,我们可以添加header,例如 Host, Referer 等

下面是代码:

Document doc = Jsoup.connect("http://www.example.com/abs/abc.html")							.header("Host", "www.example.com")
						.header("Referer", "www.example.com/index.html")
						.timeout(0).get();

另外推荐阅读jsoup的官网文档,我80%的问题都在官网找到了方法。

相关文章:

  • 2022-12-23
  • 2021-05-17
  • 2022-12-23
  • 2022-12-23
  • 2022-01-06
  • 2021-12-27
猜你喜欢
  • 2021-08-11
  • 2022-12-23
  • 2022-12-23
  • 2021-12-27
  • 2021-09-28
  • 2021-11-07
  • 2022-12-23
相关资源
相似解决方案