2016-02-20 182 views
2

我想從其他網站獲取RSS。他們使用file_get_contents除了一個環節都做工精細給我這個錯誤:file_get_contents無法打開流:HTTP請求失敗! HTTP/1.1 463

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

我下載的所有文件和所有有:

<rss version="2.0"> 

但錯誤的鏈接有:

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

這是他們之間的唯一區別。

+0

該頁面可能是檢查機器人。嘗試使用curl +頭和用戶代理頭。 http://stackoverflow.com/a/2570832/1935500 –

回答

4

在我看來,該飼料不允許你抓住它。

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.

您可以嘗試使用捲曲代替的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); 

?> 

由於阿齊茲提到的,如果你設置了代理和參照對象,就可以得到通過進行測試。

+1

我也會模仿用戶代理和推薦,這是最常見的兩個檢查標題。 –

+0

讓我試一試,看看他們是否允許它 – Mark

+0

謝謝男人我嘗試捲曲,仍然沒有工作,但是當我玩弄捲曲選項時,我發現'CURLOPT_USERAGENT,「蜘蛛」'它解決了我的問題,現在一切都很好 – Haithomy

相關問題