在向服务器发送请求时

在向服务器发送请求时

本文介绍了在向服务器发送请求时,如何查看curl发出的请求标头?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我向服务器发送请求时,我想查看由 curl 创建的请求标头。如何检查?

I want to see the request headers made by curl when I am sending a request to the server. How can I check that?

推荐答案

我认为 curl -v 最简单的。它会吐出请求头(以>开头的行),而不必写入文件:

I think curl -v is the easiest. It will spit out the request headers (lines prefixed with '>') without having to write to a file:

$ curl -v -I -H "Testing: Test header so you see this works" http://stackoverflow.com/
* About to connect() to stackoverflow.com port 80 (#0)
*   Trying 69.59.196.211... connected
* Connected to stackoverflow.com (69.59.196.211) port 80 (#0)
> HEAD / HTTP/1.1
> User-Agent: curl/7.16.3 (i686-pc-cygwin) libcurl/7.16.3 OpenSSL/0.9.8h zlib/1.2.3 libssh2/0.15-CVS
> Host: stackoverflow.com
> Accept: */*
> Testing: Test header so you see this works
>
< HTTP/1.0 200 OK
...

这篇关于在向服务器发送请求时,如何查看curl发出的请求标头?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-27 22:07