curl.cheat 950 B

12345678910111213141516171819202122232425262728293031323334353637
  1. % curl, http
  2. # send a get http request
  3. curl <url>
  4. # send a http request
  5. curl -X <method> <url>
  6. # send a http request and write the output to a file
  7. curl -X <method> <url> -o <filename>
  8. # send a get http request and follow redirects
  9. curl -L <url>
  10. # send a get http request exit with a non-zero status code on failure
  11. curl --fail <url>
  12. # send an authenticated http request
  13. curl -u <username>:<password> -X <method> <url>
  14. # send a http request with a json body
  15. curl -X <method> <url> -H 'Content-Type: application/json' -d '<json>'
  16. # send a http request with a form body
  17. curl <url> -d <bodykey>=<bodyvalue>
  18. # send a http request and see the request as well as the response
  19. curl -v <url>
  20. # send a http request with a body from a file
  21. curl -X <method> <url> --data-binary "@<file>"
  22. # send a http request with a custom header
  23. curl -X <method> <url> -H "<headername>: <headervalue>"
  24. $ file: ls
  25. $ method: echo -e 'GET\nPOST\nPUT\nDELETE\nPATCH'