(android) Jsoup模拟登录 status=404问题

求教,我用Jsoup做模拟登陆58的网站http://passport.58.com/login 而日志总是显示org.jsoup.HttpStatusException: HTTP error fetching URL. Status=404, URL=http://passport.58.com/login这是哪一方的问题?

代码如下:

String urlone = "http://passport.58.com/login";
String urltwo = "http://my.58.com/userdata";
Connection.Response response = Jsoup .connecturlone.timeout60000 .userAgent "Mozilla/5.0 Windows NT 6.1 AppleWebKit/537.36 KHTML, like Gecko Chrome/33.0.1750.117 Safari/537.36" .data"username", "CKJOKER78", "password", "theworldcup2016".methodMethod.POST .execute; String sessionID = response.cookie"SESSIONID"; Document doc = Jsoup.connect"urltwo".userAgent"Im Jsoup" .cookie"SESSIONID", sessionID.get;

因为你用了 POST 去请求 http://passport.58.com/login
通过 curl 去走这么一个请求, 你会发现 58 的服务器就是给你返回 404:

curl -I http://passport.58.com/login -X POST
HTTP/1.1 404 Not Found
Server: nginx/1.4.4
Date: Wed, 12 Mar 2014 14:12:45 GMT
Content-Type: text/html;charset=utf-8
Content-Length: 949
Connection: keep-alive

发表评论

电子邮件地址不会被公开。 必填项已用*标注