Advertisement
Guest User

Untitled

a guest
Aug 9th, 2017
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.35 KB | None | 0 0
  1. -H/--header <header>
  2. (HTTP) Extra header to use when getting a web page. You may specify
  3. any number of extra headers. Note that if you should add a custom
  4. header that has the same name as one of the internal ones curl would
  5. use, your externally set header will be used instead of the internal
  6. one. This allows you to make even trickier stuff than curl would
  7. normally do. You should not replace internally set headers without
  8. knowing perfectly well what you're doing. Remove an internal header
  9. by giving a replacement without content on the right side of the
  10. colon, as in: -H "Host:".
  11.  
  12. curl will make sure that each header you add/replace get sent with
  13. the proper end of line marker, you should thus not add that as a
  14. part of the header content: do not add newlines or carriage returns
  15. they will only mess things up for you.
  16.  
  17. See also the -A/--user-agent and -e/--referer options.
  18.  
  19. This option can be used multiple times to add/replace/remove multi-
  20. ple headers.
  21.  
  22. curl --header "X-MyHeader: 123" www.google.com
  23.  
  24. curl_setopt($ch,CURLOPT_HTTPHEADER,array('HeaderName: HeaderValue'));
  25.  
  26. curl_setopt($ch,CURLOPT_HTTPHEADER,array('HeaderName: HeaderValue','HeaderName2: HeaderValue2'));
  27.  
  28. curl -i -H "Accept: application/json" -H "Content-Type: application/json" http://hostname/resource
  29.  
  30. curl -H "Accept: application/xml" -H "Content-Type: application/xml" -X GET http://hostname/resource
  31.  
  32. curl --data "param1=value1&param2=value2" http://hostname/resource
  33.  
  34. curl --form "fileupload=@filename.txt" http://hostname/resource
  35.  
  36. curl -X POST -d @filename http://hostname/resource
  37.  
  38. curl -d "username=admin&password=admin&submit=Login" --dump-header headers http://localhost/Login
  39. curl -L -b headers http://localhost/
  40.  
  41. curl -X GET "http://localhost:3000/action?result1=gh&result2=ghk"
  42.  
  43. curl --request GET "http://localhost:3000/action?result1=gh&result2=ghk"
  44.  
  45. curl "http://localhost:3000/action?result1=gh&result2=ghk"
  46.  
  47. curl -i -H "Application/json" -H "Content-type: application/json" "http://localhost:3000/action?result1=gh&result2=ghk"
  48.  
  49. http http://myurl HeaderName:value
  50.  
  51. curl -v -H @{'custom_header'='custom_header_value'} http://localhost:3000/action?result1=gh&result2=ghk
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement