这让我发疯了,我做了这个在java中100%工作的代码,但在linux中没有试过以各种方式逃避。
这是cdoe: -
ProcessBuilder pb = new ProcessBuilder(args = new String[] {"curl", "-v", "http://www.solarmovie.is/forum/login/",
"-c", "\"cookies2.txt\"",
"-b", "\"cookies2.txt\"",
"-H", "\"Host: www.solarmovie.is\"",
"-H", "\"Origin: http://www.solarmovie.is\"",
"-H", "\"User-Agent: User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/40.0.2214.115 Safari/537.36\"",
"-H", "\"Accept-Encoding: gzip, deflate\"",
"-H", "\"Accept-Language: en-GB,en-US;q=0.8,en;q=0.6\"",
"--compressed", "",
"-H", "\"X-Requested-With: XMLHttpRequest\"",
"-H", "\"Connection: keep-alive\"",
"-H", "\"Content-Type: application/x-www-form-urlencoded; charset=UTF-\"",
"-H", "\"Referer: http://www.solarmovie.is/\"",
"--data", "\"referer=http\"%\"3A\"%\"2F\"%\"2Fwww.solarmovie.is\"%\"2F&login\"%\"5Blogin\"%\"5D="+username+"&login\"%\"5Bpassword\"%\"5D="+password + "\""
});
在Windows上: -
{"status":false,"data":{},"messages":["Wrong username or password."]}
在linux上打印
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 135 0 3639 --:--:-- --:--:-- --:--:-- 3639
106 2733 0 2733 0 135 14649 723 --:--:-- --:--:-- --:--:-- 17436
curl: (3) <url> malformed
顶部有很多数据(页面加载有404错误)
所以我认为在linux java中试图请求多于1个请求?它做错了什么分裂。
谢谢!