file_get_contents 无法打开流:HTTP 请求失败!HTTP/1.1 463

Hai*_*omy 2 php rss

我正在尝试从其他站点获取 RSS。file_get_contents除了一个链接给我这个错误之外,它们都可以正常工作:

警告:file_get_contents( http://alwatan.kuwait.tt/rss.ashx ):无法打开流:HTTP 请求失败!HTTP/1.1 463

我下载了所有文件,并且都有:

<rss version="2.0">
Run Code Online (Sandbox Code Playgroud)

但有错误的链接有:

<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
Run Code Online (Sandbox Code Playgroud)

这是他们之间唯一的区别。

Mar*_*ark 5

在我看来,该提要不允许您获取它。

463 受限客户端:您的客户端软件无法访问此资源。此请求已被阻止。请从其他客户端重试您的请求。

DOSarrest Internet Security 是一种基于云的完全托管 DDoS 保护服务。由于上述违规行为,此请求已被 DOSarrest 阻止。如果您认为自己被错误地阻止,请联系 scripts.local 的管理员以解决此问题。

您可以通过尝试使用 curl 而不是 file_get_contents 来测试这一点

<?php

$ch = curl_init("http://alwatan.kuwait.tt/rss.ashx");

curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_REFERER, "http://www.example.org/yay.htm");
curl_setopt($ch, CURLOPT_USERAGENT, "spider");

curl_exec($ch);
curl_close($ch);

?>
Run Code Online (Sandbox Code Playgroud)

正如阿齐兹所说,如果你设置了代理和推荐人,你就可以通过。