»Forumlar »D?k?manlar »Php Ülke ve şehir bulma
  https://seditio.com.tr/eski1/forums.php?m=posts&q=963
          Geri Dön      -      Sayfayı Yazdırmak için tıklayın
Author: Kaan, Posted: 2010-10-01 20:49 GMT. This post was edited by Kaan (2010-10-01 20:53 GMT, 5834 Gün ago)
Php ?lke ve ?ehir bulma
?zellikle bizim ?lkede ?ehir tutturmak ?ok ?ok zor b?lge bile zor tutuyor..
Bu nedenle do?ru verileri alamayabilirsiniz..


Bu ?zelli?i Seditio da Kullanabilirsiniz.
Kullanmak isterseniz Bildiriniz nas?l yap?laca??n? anlat?r?m.


:
hp]<?

function locateIp($ip){

    $d = file_get_contents("http://www.ipinfodb.com/ip_query.php?ip=$ip&output=xml");

 

    //Use backup server if cannot make a connection

    if (!$d){

        $backup = file_get_contents("http://backup.ipinfodb.com/ip_query.php?ip=$ip&output=xml");

        $answer = new SimpleXMLElement($backup);

        if (!$backup) return false; // Failed to open connection

    }else{

        $answer = new SimpleXMLElement($d);

    }

 

    $country_code = $answer->CountryCode;

    $country_name = $answer->CountryName;

    $region_name = $answer->RegionName;

    $city = $answer->City;

    $zippostalcode = $answer->ZipPostalCode;

    $latitude = $answer->Latitude;

    $longitude = $answer->Longitude;

    $timezone = $answer->Timezone;

    $gmtoffset = $answer->Gmtoffset;

    $dstoffset = $answer->Dstoffset;

 

    //Return the data as an array

    return array('ip' => $ip, 'country_code' => $country_code, 'country_name' => $country_name, 'region_name' => $region_name, 'city' => $city, 'zippostalcode' => $zippostalcode, 'latitude' => $latitude, 'longitude' => $longitude, 'timezone' => $timezone, 'gmtoffset' => $gmtoffset, 'dstoffset' => $dstoffset);

}

 

//Usage example

$ip = "$_SERVER[REMOTE_ADDR]";

$ip_data = locateIp($ip);

 

echo "IP adresi : " . $ip_data['ip'] . "<br>";

echo "?lke : " . $ip_data['country_name'] . "<br>";

echo "?ehir : " . $ip_data['city'] . "<br>";

?>


son mesaj 3 dakika ?nce

Ayr?ca Di?er ?zellikleride ekleyebilirsiniz.

Kod:
$country_code = $answer->CountryCode; TR
    $country_name = $answer->CountryName; ?lke
    $region_name = $answer->RegionName; bilmiyorum
    $city = $answer->City; ?ehir
    $zippostalcode = $answer->ZipPostalCode; zip kodu
    $latitude = $answer->Latitude;
    $longitude = $answer->Longitude;
    $timezone = $answer->Timezone;
    $gmtoffset = $answer->Gmtoffset;
    $dstoffset = $answer->Dstoffset;


Test etmek i?in ziyaret edin: http://backup.ipinfodb.com/

Powered by SeditioPrint version