PHP error doing file_get_contents on a Hostinger host: failed to open stream -
i'm trying use http://ip-api.com/json/ api , show information of visitant conects website on hostinguer.com.
when next, should responds me json info in json format:
echo file_get_contents("http://ip-api.com/json/{$user_ip}");
but following error message:
warning: file_get_contents(http://ip-api.com/json/[my public ip]): failed open stream: connection refused in /home/[hostinguer user]/public_html/ip2.php on line 31
and other strange thing: if use api works correctly , returns me correct json! other api command:
echo file_get_contents("http://ipinfo.io/{$user_ip}/json");
so, want use ip-api.com api cause results more accurate, works if use ipinfo.io api... why can petition website , not other?
otherwhise, tried both in local using curl or writting in webrowser , works correctly. tried in local in lammp , both works perfectly. , tried somthing post: php file_get_contents() returns "failed open stream: http request failed!" in hostinguer , doesn't works..
i thought maybe in hostinguer configuration but...
thanks in advance!
your ip address banned. if you're using normal web hosting, outgoing ip address shared other users, did more requests allowed.
go http://ip-api.com/docs/unban , enter server's outgoing ip address (check via http://ipinfo.io/json)
Comments
Post a Comment