ip=$ip; } public function getHeader(){ $headers = ''; foreach ($_SERVER as $name => $value){ if (substr($name, 0, 5) == 'HTTP_'){ $headers[str_replace(' ', '-', ucwords( strtolower( str_replace( '_', ' ', substr( $name, 5) ) ) ) )] = $value; } } return $headers; } public function getAllGeoipRecords(){ $tmp = geoip_record_by_name( $this->ip ); unset($tmp['dma_code']); unset($tmp['area_code']); return $tmp; } public function encodeJson($value){ if( empty($value) || is_null($value) || $value == "" ) return json_encode($output = array( "status" => "failure" )); else $output = array( "status" => "success" ); if ( ! is_array($value) ){ $output[] = $value; } else { $output = array_merge($output, $value); } return json_encode($output); } public function getReverseDNS($ip = NULL){ if ( is_null($ip) ) $ip = $this->ip; return gethostbyaddr($ip); } public function __destruct(){ return true; } }