Вопрос по GEO

byura

Разрушитель (V)
Сообщения
235
Симпатии
213
Баллы
3 933
Кто ставил определялку города по geo без модулей
пока нашел два способа
это api яндекса
PHP:
<script type="text/javascript">
$(document).ready(function() {
if (YMaps.location.city != '') {
    $('.country span').html(YMaps.location.country);
    $('.region span').html(YMaps.location.region);
    $('.city span').html(YMaps.location.city);
    
}
else {
    $('.nothing').html(' ');
    $('.nothing').html('Яндекс не знает где вы :)');
}
});

</script>
и api geobase

PHP:
<script>

var ip = "<?php echo $realUserIP; ?>";
  jQuery.ajax ({
    type: "GET",
    url: "http://ipgeobase.ru:7020/geo/?ip=" + ip,
    dataType: "xml",
    success: function(xml) {
      var region = jQuery(xml).find('city').text();
      jQuery(".geocity").text(region);
    },
    error: function() {
      jQuery(".geocity").text("не определен");
    }
  });

</script>
 
Назад
Верх