Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $ip = $_SERVER['REMOTE_ADDR'];
- $response = file_get_contents('http://www.geoplugin.net/php.gp?ip='.$ip);
- $array = var_export( unserialize ( $response ), 1);
- eval( '$array = '. $array .';');
- $data = new stdClass();
- $data->city = $array['geoplugin_city'].'|';
- $data->region = $array['geoplugin_region'].'|';
- $data->country = $array['geoplugin_countryName'];
- /*$data->countrycode = $array['geoplugin_countryCode'];
- $data->long = $array['geoplugin_longitude'];
- $data->lat = $array['geoplugin_latitude'];*/
- $valor_q = '';
- foreach($data as $valor) {
- $valor_q .= $valor;
- }
- $d = explode('|',$valor_q);
- $cidade = $d[0];
- $estado = $d[1];
- $pais = $d[2];
- $msg = $cidade.','.$estado.','.$pais;
- echo $msg;
- exit;
- ?>
Advertisement
Add Comment
Please, Sign In to add comment