> For the complete documentation index, see [llms.txt](https://parul-kaushik.gitbook.io/ceh-practical-notes/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://parul-kaushik.gitbook.io/ceh-practical-notes/curl.md).

# Curl

1. Fetch HTTP Headers : curl --head "<https://example.com>"
2. List contents of directory : curl --list-only "<https://example.com/foo/>"
3. Redirect query as specified by a 3xx response : curl --location "<https://iana.org>"
4. Check whether a site is down : curl --head --show-error "<http://example.com>"
5. Send form data : curl --form "username=seth" --form "password=12345678"\
   "<https://example.com/api/v4/endpoint>"
6. Send a file as form data : curl --form "profile=@me.jpg" "<https://example.com/foo/bar>"
7. Send contents of a file as form data : curl --form "description=\<file.md" "<https://example.com/foo/bar>"
8. Specify HTTP Method : curl --request POST --data "Foo: bar" "<https://example.com/api/endpoint>"
9. Curl post request :curl -d "name=username\&password=123456"
10. -s option doesnt show any error msg : curl -s URL
11. curl -s -d "username=test\&password=xyz\&submit=submit" -X POST <http://ip/login/>
12. curl -s --cookie "zyx=1" <http://ip/>
13. curl -s --user-agent "Mozilla/5.0 (iPhone; CPU iPhone OS 13\_1\_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.1 Mobile/15E148 Safari/604.1" <http://10.10.141.149/>
14. curl -s --referer "tryhackme.com" <http://zyx/free\\_sub/>
15. -H flag : sends additional preflight request headers to the server : curl -s -H "egg: Yes" <http://ip/>
