Tagged as: curl linux web

Sometimes you need to make a POST request while working with the web, and cURL allows you to do this.

This is only a basic guide, and more advanced information is available from the cURL manual.

Send a basic POST request, without any associated data:

curl -X POST https://example.com/example

Send a POST request with some data, using the application/x-www-form-urlencoded mime type:

curl -d "variable=data&variable2=data2" https://example.com/example

Any data you send using the example above must be urlencoded before being passed into cURL.

Send a POST request with some data, using the multipart/form-data mime type:

curl -F "variable=@filename.ext;type=mime/type;" https://example.com/example