A big request not to throw stones but to write on the case or to throw off the link to the already prepared guides to create authorization on the site. I rummaged through all of Google - I didn’t find anything working (Hands are not from the back) by itself a novice coder on java, but I understand the structure of the code (What, where and on what depends). We need a ready-made example with a working post request, the only thing that I found even though it showed signs of life.

try { Connection.Response res1 = Jsoup.connect("http://site.ru") .data("login","admin") .data("passwd","admin") .data("send","Войти") .method(Connection.Method.POST) .execute(); Map loginCoockies = res1.cookies(); System.out.println(loginCoockies); Document doc = Jsoup.connect("http://site.ru") .cookies(loginCoockies) .get(); System.out.println(doc); } catch (IOException e) { System.out.println(e); } return null; 

After launch issues:

{PHPSESSID = t7idbm5jkr40ial25brvju72n2}

and html page code.

More precisely, after each press of the button gives PHPSESSID = (Always different). The html code page shows that I was never authorized.

  • I tried to send a POST request using ready-made programs or utilities or browser plug-ins, does everything work as expected? - Schullz
  • Tried to do authorization on Delphi, everything works. - Hromik
  • @ Dima Philosopher interested: “Good afternoon. I can not yet leave a comment, so I have to write it like this. I am also interested in a similar question. And I wanted to know if you could share with what you could do. I would be very grateful if you sent a link to the repository. Thank you. ” - ߊߚߤߘ

1 answer 1

I figured it out myself, the authorization is successful, the check is also.
I downloaded HTTP Analyzer and looked at what data is sent by POST request and where.
Added missing data to request, and it worked)