fork download
  1. function occurrence($ip='', $to = 'utf-8'){
  2. $ip = ($ip) ? $ip : $_SERVER['REMOTE_ADDR'] ;
  3. $xml = simplexml_load_file('http://i...content-available-to-author-only...e.ru:7020/geo?ip='.$ip);
  4. if($xml->ip->message){
  5. if( $to == 'utf-8' ) {return $xml->ip->message;} else {
  6. if( function_exists( 'iconv' ) ) return iconv( "UTF-8", $to . "//IGNORE",$xml->ip->message);else return "The library iconv is not supported by your server";}
  7. } else { if( $to == 'utf-8' ) {return $xml->ip->region;} else {if( function_exists( 'iconv' ) ) return iconv( "UTF-8", $to . "//IGNORE",$xml->ip->region);else return "The library iconv is not supported by your server";}}}
  8. echo occurrence('','utf-8');
Success #stdin #stdout 0.01s 24448KB
stdin
Standard input is empty
stdout
function occurrence($ip='', $to = 'utf-8'){
$ip = ($ip) ? $ip : $_SERVER['REMOTE_ADDR'] ;
$xml =  simplexml_load_file('http://i...content-available-to-author-only...e.ru:7020/geo?ip='.$ip);
if($xml->ip->message){
if( $to == 'utf-8' ) {return $xml->ip->message;} else {
if( function_exists( 'iconv' ) ) return iconv( "UTF-8", $to . "//IGNORE",$xml->ip->message);else return "The library iconv is not supported by your server";}
} else { if( $to == 'utf-8' ) {return $xml->ip->region;} else {if( function_exists( 'iconv' ) ) return iconv( "UTF-8", $to . "//IGNORE",$xml->ip->region);else return "The library iconv is not supported by your server";}}}
echo occurrence('','utf-8');