这是网址:https ://www.grammarly.com
我正在尝试使用本机get_headers()
函数获取 HTTP 标头:
$headers = get_headers('https://www.grammarly.com')
结果是
HTTP/1.1 400 Bad Request
Date: Fri, 27 Apr 2018 12:32:34 GMT
Content-Type: text/plain; charset=UTF-8
Content-Length: 52
Connection: close
但是,如果我对curl
命令行工具做同样的事情,结果会有所不同:
curl -sI https://www.grammarly.com/
HTTP/1.1 200 OK
Date: Fri, 27 Apr 2018 12:54:47 GMT
Content-Type: text/html; charset=UTF-8
Content-Length: 25130
Connection: keep-alive
造成这种反应差异的原因是什么?它是在 Grammarly 的服务器端还是其他一些实施不善的安全功能?