Error: PHP: [14:47:52] [Server thread/CRITICAL]: ErrorException: "file_get_contents(): php_network_getaddresses: getaddrinfo failed: Temporary failure in name resolution" (EXCEPTION) in "UserGeo-master/src/UserGeo/Main" at line 51 code: PHP: $data = json_decode(file_get_contents("http://ipinfo.io/" . $player_ip), true);[/U]
That exception is thrown when PHP is unable to lookup the domain name. Use an IP lookup service and get the IP of the site and use it over the domain.
Did it ever work? If not, check that allow_url_fopen is enabled in php.ini. Alternatively you can use cURL. Using an IP address instead is not a good idea, unless you are sure their IP never changes... Also, we can't tell from the code you posted, but you should handle exceptions for file_get_contents, and use AsyncTask for any Web requests made by plugins.
If you're using PHP-FPM it needs to be restarted/reloaded. If not OPCache may need to be cleared for the changes to go into effect.
No need to restart anything except pocketmine. As sofe suggested, check your firewall allows http traffic.
This issu is solved but i have an other one Old issu: In resolv.conf i juste added ' nameserver 208.67.222.222' New issu PHP: [00:32:04] [Server thread/CRITICAL]: Unhandled exception executing command 'geo arm city' in usergeo: Trying to get property 'city' of non-object [00:32:04] [Server thread/CRITICAL]: ErrorException: "Trying to get property 'city' of non-object" (EXCEPTION) in "UserGeo-master/src/UserGeo/Main" at line 53 PHP: $player_display_name = $player->getName(); $player_ip = $player->getAddress(); $data = file_get_contents("http://ipinfo.io/" . $player_ip . "/json"); $player_city = $data->city; $player_hostname = $data->hostname; $player_region = $data->region; $player_country = $data->country;
I have this error when i try go get the hostname. PHP: [09:24:10] [Server thread/CRITICAL]: Unhandled exception executing command 'usergeo VirVoltaSurMC Franche-Comté' in usergeo: Undefined property: stdClass::$hostname[09:24:10] [Server thread/CRITICAL]: ErrorException: "Undefined property: stdClass::$hostname" (EXCEPTION) in "UserGeo-master/src/UserGeo/Main" at line 49 PHP: $player_display_name = $player->getName(); $player_ip = $player->getAddress(); $data = file_get_contents("http://ipinfo.io/" . $player_ip); $json = json_decode($data, false); $player_city = $json->city; $player_hostname = $json->hostname;//error here $player_region = $json->region; $player_country = $json->country;
It seems it's not defined. I reccomend you doing var_dump($json) to see all defined keys on $json data array
PHP: object(stdClass)#16263 (8) { ["ip"]=> string(12) "" ["hostname"]=> string(24) "" ["city"]=> string(7) "" ["region"]=> string(18) "" ["country"]=> string(2) "" ["loc"]=> string(15) "" ["org"]=> string(14) "" ["postal"]=> string(5) ""}