<?php $data = file_get_contents('http://ip-api.com/json/'.$_SERVER['REMOTE_ADDR'].'?fields=regionName'); $data = json_decode($data, true); echo $data['regionName']; ?>