I want to see the request headers made by curl
when I am sending a request to the server. How can I check that?
相关问题
- Google Apps Script: testing doPost() with cURL
- Can I skip certificate verification oracle utl_htt
- Requests Library Force Use of HTTP/1.1 On HTTPS Pr
- Change curl SSL Version
- What means data-urlencode in CURL?
相关文章
- Programmatically scraping a response header within
- What to do with extra HTTP header from proxy?
- How can I immediately cancel a curl operation?
- Get Amazon MWS results to Json or Xml and elaborat
- POST csv/Text file using cURL
- curl: (3) Illegal characters found in URL
- How to force CURL to ask for http/1.1? Or maybe th
- Facebook API error subcode 33
curl --trace-ascii {filename} or use a single dash instead of file name to get it sent to stdout:
CURLOPT_DEBUGFUNCTION if you're using libcurl
This shows you everything curl sends and receives, with some extra info thrown in.
The only way I managed to see my outgoing headers (curl with php) was using the following options:
Getting your debug info:
You can use wireshark or tcpdump to look on any network traffic (http too).
The question did not specify if command line command named
curl
was meant or the whole cURL library.The following PHP code using cURL library uses first parameter as HTTP method (e.g. "GET", "POST", "OPTIONS") and second parameter as URL.
Example usage:
Note that the results are nearly identical to following command line
You can see it by using
-iv
The
--trace-ascii
option to curl will show the request headers, as well as the response headers and response body.For example, the command
produces a file
curl.trace
that starts as follows:It also got a response (a 302 response, to be precise but irrelevant) which was logged.
If you only want to save the response headers, use the
--dump-header
option:If you need more information about the options available, use
curl --help | less
(it produces a couple hundred lines of output but mentions a lot of options). Or find the manual page where there is more explanation of what the options mean.