Loading...
web2.0

Geo localisation par IP

Si vous désirez connaitre la provenance de vos visiteurs, voici deux méthodes pour geo localiser. Bien sûr ce positionnement n’est pas très précis car l’IP dépend de votre FAI, mais la localisation reste intéressante surtout si l’on a des visiteurs du monde entier.

Méthode I en javascript via les API Google : pour obtenir une API KEY

Step 1: Charger Google AJAX API script

<script type="text/javascript" src="http://www.google.com/jsapi?key=API_KEY_GOES_HERE"></script>

Step 2: Extraire la localisation par google.loader.ClientLocation

if(google.loader.ClientLocation)
{
	visitor_lat = google.loader.ClientLocation.latitude;
	visitor_lon = google.loader.ClientLocation.longitude;
	visitor_city = google.loader.ClientLocation.address.city;
	visitor_region = google.loader.ClientLocation.address.region;
	visitor_country = google.loader.ClientLocation.address.country;
	visitor_countrycode = google.loader.ClientLocation.address.country_code;
}
else
{
	// pas trouve
}

Deuxième méthode II en PHP :

< ?php		
	 $IpAddress=$_SERVER["REMOTE_ADDR"];
	 $adress = 'http://www.geobytes.com/IpLocator.htm?GetLocation&template=php3.txt&IpAddress='.$IpAddress;
	 $tags = get_meta_tags($adress);
print $tags['city'];  // city name
print $tags['country'];  // country name
?>

78 comments
  1. bape hoodie

    I want to voice my gratitude for your kind-heartedness in support of persons who absolutely need help on this important theme. Your special dedication to passing the solution all around has been exceedingly powerful and have always enabled girls just like me to attain their goals. Your entire warm and helpful instruction can mean a great deal a person like me and even more to my mates. Regards; from each one of us.

  2. golden goose sneakers

    I intended to put you the bit of observation just to say thanks a lot as before considering the spectacular advice you’ve discussed on this site. This is really shockingly open-handed of you to give without restraint all that a lot of people could possibly have offered for an ebook to make some profit on their own, primarily given that you could possibly have tried it in case you considered necessary. The tricks in addition worked like a great way to fully grasp that most people have the same keenness much like my own to realize more and more concerning this problem. Certainly there are many more pleasurable periods in the future for people who look into your site.

  3. supreme new york

    I want to get across my appreciation for your kindness for men who actually need help on this area of interest. Your real dedication to getting the message along appears to be particularly insightful and have consistently enabled guys and women just like me to get to their desired goals. Your valuable help signifies a lot a person like me and extremely more to my mates. Regards; from all of us.

  4. paul george shoes

    I precisely had to say thanks yet again. I am not sure what I might have achieved in the absence of those concepts documented by you concerning such problem. It was before a very horrifying scenario in my view, however , discovering a new well-written way you solved that took me to leap with joy. Now i’m happier for the support and trust you recognize what a powerful job you happen to be accomplishing teaching other individuals by way of your website. Most likely you haven’t come across all of us.

  5. yeezy wave runner 700

    I wish to show my gratitude for your kind-heartedness for visitors who require guidance on this particular matter. Your real dedication to getting the solution all around came to be amazingly practical and have empowered people like me to reach their dreams. Your entire useful publication denotes a great deal a person like me and especially to my office colleagues. With thanks; from all of us.

  6. Golden Goose Deluxe Brand

    I wish to express my affection for your kind-heartedness in support of those individuals that actually need help with this situation. Your special commitment to passing the message along became incredibly advantageous and have without exception permitted somebody much like me to arrive at their objectives. Your new informative facts means a great deal a person like me and still more to my fellow workers. Best wishes; from everyone of us.

  7. kyrie spongebob

    I wish to get across my affection for your kind-heartedness in support of men and women that need guidance on this particular topic. Your personal commitment to getting the solution all around had been incredibly interesting and has continuously encouraged some individuals just like me to attain their objectives. Your warm and helpful recommendations indicates this much to me and even further to my fellow workers. Thanks a ton; from everyone of us.

  8. golden goose

    I just wanted to post a simple message in order to say thanks to you for some of the superb tips and tricks you are writing on this site. My time intensive internet search has finally been honored with reliable suggestions to talk about with my best friends. I would say that many of us readers are extremely blessed to live in a superb place with very many lovely professionals with beneficial hints. I feel truly fortunate to have discovered your website and look forward to some more excellent moments reading here. Thanks a lot once more for everything.

  9. supreme clothing

    Needed to send you that bit of note to finally say thanks a lot again with your precious methods you’ve shared in this case. It has been certainly incredibly generous with people like you to deliver extensively what exactly some people would’ve made available for an e-book to help with making some dough for themselves, principally since you could have done it if you desired. The tactics in addition acted as the fantastic way to be certain that other people online have similar fervor like mine to see somewhat more with respect to this issue. I think there are lots of more fun situations in the future for people who browse through your site.

  10. off white outlet

    I would like to get across my appreciation for your kindness supporting persons who must have help on that topic. Your personal dedication to getting the solution all through was incredibly valuable and has encouraged people just like me to realize their dreams. Your entire warm and helpful tutorial can mean a lot to me and even further to my fellow workers. Many thanks; from everyone of us.

  11. kobe sneakers

    I am also writing to make you know what a fantastic experience my wife’s daughter found using your blog. She noticed such a lot of details, most notably how it is like to possess an ideal coaching mindset to get other individuals with no trouble know just exactly several very confusing matters. You actually surpassed our own desires. Thank you for giving such necessary, safe, explanatory not to mention easy tips on the topic to Kate.

Laisser un commentaire

Votre adresse e-mail ne sera pas publiée.