2017-10-19 212 views
0

我正在使用freegeoip爲我的客戶端獲取ip地址的地理位置。 一切工作正常,但突然所有的錯誤是顯示在頂部區域在網站上說,freegeoip 403禁止

嚴重性:警告消息: 的file_get_contents(http://freegeoip.net/json/39.37.152.1):未能 打開流:HTTP請求失敗! HTTP/1.1 403禁止

當我看到問題時,我發現網站命中限制超過了,所以這就是錯誤顯示的原因。

這是我的地盤http://www.acssynergy.com/沒有任何一個有想法 ,這個錯誤會保持多久顯示已經過了24小時, 錯誤仍然存​​在

回答

1

目前,如果我檢查http://freegeoip.net/json/84.236.112.202

結果爲:

ip "84.236.112.202" 
country_code "HU" 
country_name "Hungary" 
region_code "BU" 
region_name "Budapest" 
city "Budapest" 
zip_code "1012" 
time_zone "Europe/Budapest" 
latitude 47.5 
longitude 19.0833 
metro_code 0 

同時,您的網站http://www.acssynergy.com/給我:

A PHP Error was encountered 

Severity: Warning 

Message: file_get_contents(http://freegeoip.net/json/84.236.112.202): failed to open stream: HTTP request failed! HTTP/1.1 403 Forbidden 

Filename: controllers/Welcome.php 

Line Number: 42 

Backtrace: 

File: /hermes/bosnacweb01/bosnacweb01aw/b2306/ipg.acsadminnet/acssynergy/application/controllers/Welcome.php 
Line: 42 
Function: file_get_contents 

File: /hermes/bosnacweb01/bosnacweb01aw/b2306/ipg.acsadminnet/acssynergy/index.php 
Line: 309 
Function: require_once 

從freegeoip檢查答案標題:

CF-RAY 3b0174ce90247f00-BUD 
Connection keep-alive 
Content-Encoding gzip 
Content-Type application/json 
Date Thu, 19 Oct 2017 05:49:49 GMT 
Server cloudflare-nginx 
Set-Cookie __cfduid=dc13fe607037f5a784ef21ffae22ab31d1508392189; expires=Fri, 19-Oct-18 05:49:49 GMT; path=/; domain=.freegeoip.net; HttpOnly 
Transfer-Encoding chunked 
Vary Origin 
X-Database-Date Thu, 05 Oct 2017 01:49:14 GMT 
X-Ratelimit-Limit 15000 
X-Ratelimit-Remaining 14999 
X-Ratelimit-Reset 3600 

請檢查您的X-Ratelimit-Remaining。如果它爲0,則必須等到X-Ratelimit-Reset才能從此站點獲取值(未測試)。 如果你檢查你的X-Ratelimit-Reset你會知道什麼時候你可以再次連接。

另一個更改geoip提供者的解決方案。詳情在這裏:freegeoip doesn't work anymore

+0

嗨感謝您的答覆...可以讓我知道我該如何檢查X-Ratelimit-Remaining ..是否有任何工具或somthing ... – usman

+0

嗨。我不是一個PHP大師(它似乎你使用PHP),你使用流。 在這種情況下'$ http_response_header'是你的變量。 來源:http://php.net/manual/en/wrappers.http.php –