Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /*
- Créditos: geoplugin
- Adaptado por: Kyl3
- */
- $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->lat = $array['geoplugin_latitude'];*/
- $data->long = $array['geoplugin_longitude'];
- $valor_q = '';
- foreach($data as $valor) {
- $valor_q .= $valor;
- }
- $d = explode('|',$valor_q);
- $cidade = $d[0];
- $estado = $d[1];
- $pais = $d[2];
- $gmt = round($data->long / 15);
- $gmt > 0 ? $gmt = "+".$gmt : $gmt;
- date_default_timezone_set("America/Sao_Paulo");
- $horalocal = date("H") + 3 + $gmt;
- echo $horalocal;
- exit;
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement