dongxue7306 2016-02-20 15:46
浏览 371
已采纳

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

I am trying to get RSS from other sites. They all work fine using file_get_contents except one link give me this error:

Warning: file_get_contents(http://alwatan.kuwait.tt/rss.ashx): failed to open stream: HTTP request failed! HTTP/1.1 463

I download all files and all have:

<rss version="2.0">

but the link with error have:

<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">

this is the only difference between them.

  • 写回答

1条回答 默认 最新

  • dongpan1365 2016-02-20 15:53
    关注

    Looks to me that that feed is not allowing you to grab it.

    463 Restricted Client: This resource is not available for access by your client software. This request has been blocked. Please retry your request from a different client.

    DOSarrest Internet Security is a cloud based fully managed DDoS protection service. This request has been blocked by DOSarrest due to the above violation. If you believe you are getting blocked in error please contact the administrator of scripts.local to resolve this issue.

    You can test this by trying to use a curl instead of 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);
    
    ?>
    

    As Aziz mentioned, if you set the agent and the referred, you can get through.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 eda:门禁系统设计
  • ¥50 如何使用js去调用vscode-js-debugger的方法去调试网页
  • ¥15 376.1电表主站通信协议下发指令全被否认问题
  • ¥15 物体双站RCS和其组成阵列后的双站RCS关系验证
  • ¥15 复杂网络,变滞后传递熵,FDA
  • ¥20 csv格式数据集预处理及模型选择
  • ¥15 部分网页页面无法显示!
  • ¥15 怎样解决power bi 中设置管理聚合,详细信息表和详细信息列显示灰色,而不能选择相应的内容呢?
  • ¥15 QTOF MSE数据分析
  • ¥15 平板录音机录音问题解决