curl

Send HTTP requests

Usage

      curl URL
    

Sends an HTTP GET request to URL

Common Flags

-X, --request METHOD Specify the request method (e.g., GET, POST, PUT)-d, --data DATA Send the specified data in a POST request--json DATA Send the specified JSON data in a POST request-H, --header HEADER Add the specified header to the request-i Include HTTP response headers in the output-o, --output FILE Write output to FILE instead of stdout

Examples

GET request

      curl http://example.com
    

Sends an HTTP GET request to example.com

POST request

      curl -X POST -d "username=admin&password=1234" http://example.com
    

Sends an HTTP POST request

POST request with JSON data

      curl -X POST --json '{ "username": "admin", "password": "1234" }' http://example.com
    

Sends an HTTP POST request with JSON data

Additional Header

      curl -H "Authorization: Basic YWRtaW46MTIzNA==" http://example.com
    

Sends an HTTP GET request with authentication