Skip to content

Instantly share code, notes, and snippets.

@mk79
mk79 / PHP: IP-Adresse lokalisieren.php
Last active December 13, 2015 23:59
PHP: IP-Adresse lokalisieren
<?php
function detect_city($ip) {
$default = 'UNKNOWN';
if (!is_string($ip) || strlen($ip) < 1 || $ip == '127.0.0.1' || $ip == 'localhost')
$ip = '8.8.8.8';
$curlopt_useragent = 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2) Gecko/20100115 Firefox/3.6 (.NET CLR 3.5.30729)';