GarryOne Posted July 10, 2013 Report Posted July 10, 2013 Am facut un script, micut, poate folositor cuiva. Iti returneaza adresa exacta, adica tara, orasul, strada. Am folosit HTML5 GeoLocation, Ajax, si google Maps API.page.html<script src="http://code.jquery.com/jquery-latest.min.js"></script><script>navigator.geolocation.getCurrentPosition(success);function success(position) { var latt = position.coords.latitude; var longg = position.coords.longitude; $.ajax({ type: 'post', url: 'ajax.php', data: {latt : latt, longg : longg}, success: function(raspuns) { $('#rsp').html(raspuns); } });}</script><div id="rsp"></div>ajax.php<?php$url = 'http://maps.googleapis.com/maps/api/geocode/json?latlng='.$_POST['latt'].','.$_POST['longg'].'&sensor=true';$jsondata = json_decode(file_get_contents($url),true);$adresa = $jsondata['results'][0]['formatted_address'];echo $adresa;?> 1 Quote
nacks Posted July 11, 2013 Report Posted July 11, 2013 ... poti adauga o linie in script prin care sa faci log pentru fiecare interogare ?MS Quote
GarryOne Posted July 12, 2013 Author Report Posted July 12, 2013 in ajax.php, la sfarsit adaugi:$fp = fopen('logs.txt', 'a+');$content = $_SERVER['REMOTE_ADDR'] . ';' . date("d-m-Y H:i:s") . ';' . $adresa . '\r\n';fwrite($fp, $content);fclose($fp);Vei avea log-urile in fisier logs.txt sub formaIP;data;adresaIP;data;adresa.... Quote
mutu1109 Posted July 12, 2015 Report Posted July 12, 2015 Salutare, stiu k e vechi topicul dar am zis sa nu fac altul.Caut de vreo 2 zile si nu gasesc nimic concretAm nevoie de un script sau program unde sa ii dau o lista de 30-40 k de ip-uri si el sa imi gaseasca din ce tara sunt si sa le sorteze Quote
endemic Posted July 12, 2015 Report Posted July 12, 2015 <?=(is_array($c=json_decode(file_get_contents("http://ip-api.com/json/208.80.152.201"),true)) ? (array_key_exists("countryCode",$c) ? $c['countryCode'] : null) : null);?> Quote