try {
org.jsoup.Connection.Response res = (org.jsoup.Connection.Response) Jsoup.connect(url)
.data(postParams)
.header(cookies1)
.header("Cache-Control", "private")
.header("Content-Length","")
.header("Accept-Language", "tr-TR,tr;q=0.8,en-US;q=0.5,en;q=0.3")
.header("Connection", "keep-alive")
.header("Cookie", "ASP.NET_SessionId=" + res1.cookie("ASP.NET_SessionId"))
.header("Host", "www.xxxxxxxxx.org")
.header("Referer", "http://www.xxxxxxx.org.tr/xxxxx.aspx")
.header("User-Agent", "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:22.0) Gecko/20100101 Firefox/22.0")
.header("Content-Type", "text/html; charset=utf-8")
.header("Location", "/xxxxxx.aspx")
.header("Server", "Microsoft-IIS/7.5")
.header("X-AspNet-Version", "4.0.30319")
.header("X-Powered-By", "ASP.NET")
.method(org.jsoup.Connection.Method.POST)
.execute();
我想发送一个帖子服务器并获取页面和服务器发送我想要在会话中解析但我得到错误500你能帮我解决它吗
答案 0 :(得分:0)
Http 500是内部服务器错误。如果处理请求有问题,那意味着服务器本身。通常由服务器主机来检查日志文件以查找错误。但是,根据我的经验,错误地格式化post请求会产生这样的错误。仔细检查您是否正确格式化了您的请求。使用像Http Components by Apache这样的库来促进你的发布请求,以及Jsoup来解析返回的信息可能会有所帮助。