400 错误请求 SEC-43

400 Bad Request SEC-43

有一个函数(下面的代码)来验证 URL 是否确实存在,而 运行 变成一个失败的函数。它 works fine 虽然在浏览器中,这就是为什么我很好奇 为什么 这个 URL 失败了。

我得到的回复是:

HTTP/1.1 400 Bad Request
content-length: 378
x-synthetic: true
expires: Thu, 01 Jan 1970 00:00:00 UTC
pragma: no-cache
cache-control: no-cache, must-revalidate
content-type: text/html; charset=UTF-8
connection: close
date: Sat, 25 Mar 2017 14:05:45 UTC
x-contextid: 1INsx8lY/G2fZ1ojZ
x-via: 1.1 echo105

<html>
<head>
<title>400 Bad Request</title>
<style> body { background-color: #F2F2F2; color: #3E3E3E; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 12px; } pre { word-wrap: break-word; } </style>
</head>
<body>
<h1>400 Bad Request</h1>
<p><pre>1INsx8lY/G2fZ1ojZ @ Sat, 25 Mar 2017 14:05:45 GMT</pre>
<p><pre>SEC-43</pre>
<p><pre></pre>
</body>
</html>

神秘的上下文 ID 和时间戳一直在变化,但除此之外我得到的是同样的东西。

我试图搜索 "bad request" 和 "SEC-43",但我似乎得到的只是一堆显示相同错误 html 的结果。单击它们会导致错误的证书、其他错误,或者它们会重定向到其他地方。

有人知道这里发生了什么吗?

恶意软件?某种神奇的非浏览器流量阻塞?


代码

<?php
$c = curl_init();
curl_setopt_array($c, [
    CURLOPT_URL => 'https://www.bergenadventistkirke.com',
    CURLOPT_HEADER => true,
    CURLOPT_FOLLOWLOCATION => true,
]);
ob_start();
curl_exec($c);
curl_close($c); 

header('content-type: text/plain; charset=utf-8');
echo ob_get_clean();

他们正在检查 User-Agent header 并在没有看到时返回 HTTP 400 Bad Requestcurl 在命令行设置用户代理 curl/7.46.0,这就是它起作用的原因。

尝试:

$c = curl_init();
curl_setopt_array($c, [
    CURLOPT_URL => 'https://www.bergenadventistkirke.com',
    CURLOPT_HEADER => true,
    CURLOPT_FOLLOWLOCATION => true,
    CURLOPT_USERAGENT => "curl/7.46.0"
]);
ob_start();
curl_exec($c);
curl_close($c);

header('content-type: text/plain; charset=utf-8');
echo ob_get_clean();