【发布时间】:2014-05-16 06:38:32
【问题描述】:
我想使用 Jsoup 访问位于网络服务器上的网站的一些数据。每次我尝试通过有效的 URL 进行连接时,我都会检索 HttpStatusException 并出现以下错误:
Exception in thread "main" org.jsoup.HttpStatusException: HTTP error fetching URL. Status=500, URL=http://sv.thisismydomain.de/path/xyz.jsp(我已更改网址)
这是我的尝试:
System.out.println(Jsoup.connect(urlBase + urlLoginForm).userAgent(userAgent).timeout(10000).get().html());
我确定这是正确的 URL。如果我将它从 StackTrace 复制到浏览器中,该 URL 可以正常工作 - 所以这不是问题。
这是我正在使用的用户代理:
String userAgent = "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) " +
"Chrome/30.0.1599.101 Safari/537.36";
你有什么想法吗?这让我抓狂!
【问题讨论】:
-
urlBase + urlLoginForm,urlBase和urlLoginForm的值是多少??
-
String urlBase = "ht tp:/ /sv.thisismydomain.de/path/" String urlLoginForm = "xyz.jsp"; //(添加空格,因为编辑器将该值识别为超链接)
标签: java jsoup web-crawler