Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/288.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 如何检查网站是否缺少阻止内容类型嗅探的标题_Php_Header_Content Type - Fatal编程技术网

Php 如何检查网站是否缺少阻止内容类型嗅探的标题

Php 如何检查网站是否缺少阻止内容类型嗅探的标题,php,header,content-type,Php,Header,Content Type,我想知道,如果网站缺少内容类型嗅探头,我如何使用域名进行检查。服务器不是我的,所以我不能在里面创建php文件或编辑.htaccess文件。我知道使用git bash和curl可以检查php版本,但是使用curl也可以检测到缺少的头吗?还是有别的办法?(当然只有合法)您可以使用-D选项: -D, --dump-header <filename> Write the received headers to <filename> curl http://whatever.

我想知道,如果网站缺少内容类型嗅探头,我如何使用域名进行检查。服务器不是我的,所以我不能在里面创建php文件或编辑
.htaccess
文件。我知道使用git bash和
curl
可以检查php版本,但是使用
curl
也可以检测到缺少的头吗?还是有别的办法?(当然只有合法)

您可以使用-D选项:

-D, --dump-header <filename> Write the received headers to <filename>



curl http://whatever.com -D myheaders.txt
-D,--dump头将接收到的头写入
卷曲http://whatever.com -D myheaders.txt

然后打开myheaders.com,查找您想要的标题。

现在的每个主要互联网浏览器(Chrome、Fx、MSIE…)都可以让您在其开发人员工具中看到网络传输,包括每个请求和每个响应的标题:


使用邮递员发送请求并查看来自此类请求的响应只需检查响应是否有以下标题:
X-Content-Type-Options=nosniff
它给了我
内容类型→text/html
到内容类型,但没有
X-content-type-Options
您可以在浏览器开发工具中打开“网络”选项卡,转到要检查的URL,查看“网络”选项卡中的响应标题。“但是没有X-content-type-Options”-然后就是您的答案。该网站不阻止内容嗅探。myheaders.com或myheaders.txt提供了许多有用的答案,但您提供了浏览器集成的答案,因此它是最简单、最快速的