典型的404响应消息


typical 404 response message

我想看起来像一个HTTP response header看起来像…我正在使用PHP…特别是我想看到一个典型的HTTP 404响应头…如果有一个php服务器数组包含所有的http头信息我想找到它!!上面的数组有他的项目顺序,谁将首先发送它?

提前谢谢!!

我有wireshark安装到我的电脑,但我不知道如何搜索http响应消息!!

nc(1) netcat工具可以很容易地做到这一点,假设您已经配置了某种web服务器:

$ echo -n -e "GET /does_not_exit HTTP/1.1'r'nHost: localhost'r'n'r'n" | nc localhost 80
HTTP/1.1 404 Not Found
Server: nginx/0.8.54
Date: Mon, 02 Jan 2012 02:33:17 GMT
Content-Type: text/html
Content-Length: 169
Connection: keep-alive
<html>
<head><title>404 Not Found</title></head>
<body bgcolor="white">
<center><h1>404 Not Found</h1></center>
<hr><center>nginx/0.8.54</center>
</body>
</html>
$ 

使用HTTPFox。这是一个非常漂亮/简单的头部查看器。安装它,激活它,点击一些你知道会产生404的url,然后查看响应。

l

如果您想使用404错误:

header("HTTP/1.0 404 Not Found");

然而,大多数你正在寻找的信息可以在这里找到:http://php.net/manual/en/function.header.php

:http://php.net/manual/en/reserved.variables.server.php

这些是可以用来显示服务器信息的变量。header函数将HTTP头设置为您想要的任何内容。您可以使用firebug或开发人员工具或浏览器自带的任何工具查看大多数头信息。

Firebug的Net选项卡可能会有帮助。

http://getfirebug.com/