所以我有这个要求
args = new String[] {"curl", "-v", "http://www.example.com/login", "-x", `"http://"+solarProxy+":"+solarPort, "-c", "cookies2.txt", "-b", "cookies2.txt", "-H", "\"Host: www.example.com\"", "-H", "\"Origin: http://www.example.com\"", "-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.example.com/\"", "--data", "\"referer=http\"%\"3A\"%\"2F\"%\"2Fwww.example.com\"%\"2F&login\"%\"5Blogin\"%\"5D="+username+"&login\"%\"5Bpassword\"%\"5D="+password + "\"" };`
我使用Java登录网站A
问题在于,当我通过Java进行操作时,它不会保存cookie,但是通过cmd它可以完美地工作。