jeudi 8 mars 2018

How to do http post with payload in java

When I click a button on webpage I get following information in developer tools:

Request URL:https://example.com/path/eventAction.do
Request Method:POST
Status Code:200 OK

and Request headers like below:

Accept:*/*
Accept-Encoding:gzip, deflate, br
Accept-Language:en-US,en;q=0.9
Connection:keep-alive
Content-Length:1600
Content-Type:multipart/form-data; boundary=----
WebKitFormBoundaryZ9ymd7fGOwOFpELi
Cookie:JSESSIONID=C1rX...

and Request payload like:

------WebKitFormBoundaryZ9ymd7fGOwOFpELi
Content-Disposition: form-data; name="example1"

FILTER_900000
------WebKitFormBoundaryZ9ymd7fGOwOFpELi
Content-Disposition: form-data; name="example2"


------WebKitFormBoundaryZ9ymd7fGOwOFpELi
Content-Disposition: form-data; name="example3"

08/03/2018

How can I send this http post with Apache HttpClient or is there any other method to imitate button click event with java code..

Aucun commentaire:

Enregistrer un commentaire