Filling out forms, getting a cookie

  1. Host
  2. Manipulating headers
  3. Response codes

In this part of the tutorial, we will log in to a remote server by sending the headers and body that get sent when a visitor fills out a form and submits it. We will then take the cookie that the remote server sends to the client on a successful login and use that cookie to maintain the session.

curl --form user=username --form password="password" https://www.example.com/login/ --trace-ascii -

Look for the Set-Cookie: header from the server. Copy it out and use it in HTTP Client.

Cookie: cookie=value

Cookie: ExampleKey=79202038fea9608456ad6aa363173dea

In HTTP Client, send this body to http://www.example.com/login/:

user=username&password=password

with

Content-Type: application/x-www-form-urlencoded

to see the cookie and cookie value.

Then, look for the Set-Cookie header and use that cookie to enter the page.

If the password contains special characters, they may need to be encoded. For example, an ampersand will need to be %26, and an apostrophe %27.

  1. Host
  2. Manipulating headers
  3. Response codes