How can I get the latitude and longitude of a vistor on my website?

Andre Andre Rotaru

I am researching ways of making ads actually relevant to people. How can I get the location of a visitor, who just loaded my page? I'm not talking IP Geo-location, I'm talking the exact latitude and longitude of a user, that I could later store in a database. Is there an API or something to allow me to get those values in PHP variables, using something like GPS?

Anand Jain

First get visitor's location details from IP address

How to get user IP Address in PHP

<?php
$ip = $_SERVER['REMOTE_ADDR'];
echo $ip;
?>

How to get user/ visitor Location in PHP

<?php
require_once("userip/ip.codehelper.io.php");
require_once("userip/php_fast_cache.php");

$_ip = new ip_codehelper();

$real_client_ip_address = $_ip->getRealIP();
$visitor_location       = $_ip->getLocation($real_client_ip_address);

$guest_ip   = $visitor_location['IP'];
$guest_country = $visitor_location['CountryName'];
$guest_city  = $visitor_location['CityName'];
$guest_state = $visitor_location['RegionName'];

echo "IP Address: ". $guest_ip. "<br/>";
echo "Country: ". $guest_country. "<br/>";
echo "State: ". $guest_state. "<br/>";
echo "City: ". $guest_city. "<br/>";

?>

For more detail kindly visit below link

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

Given longitude and latitude, how can I get the code and name of a country?

How can I get city name from a latitude and longitude point?

How can I get Latitude and Longitude From JSON web Service?

How can I get accurate latitude/longitude of current GPS location?

I need to get the latitude and longitude of my marker

XAML data.binding - how can I bind properties in my method to the longitude/latitude in my view?

how can I fetch the longitude and latitude from a specific point on my mapview in swift?

How do I get the latitude and longitude out of my array structure and create a marker?

How can i get latitude and longitude values from udp packets c#

How can I call MapLocationFinder.FindLocationsAsync() to get the coordinates for an address without already knowing the latitude and longitude?

How can I get latitude & longitude by using address from google geocode API in Configure.IT API flow

How can I get Longitude and latitude of Address Enter in Input field in react native

Can I get latitude and longitude for multiple addresses at a time with leaflet js?

Why can't I get latitude and longitude using getBounds function?

How can I add tha value of longitude and latitude

How can i know the latitude(X) and longitude(Y) position of iBeacons

In java, how can i calculate distance between multiple latitude and longitude?

How can I find nearby place with latitude and longitude in mongodb?

How can i use longitude and latitude with typeorm and postgres

how can i search database table with latitude and longitude using sequelize

How do I get the latitude and longitude from the following?

How to get longitude and latitude values without using the Internet from the phone? If possible can i get code and i am using API 26

How can i plot a map using Latitude and longitude data in python & Highlight few Latitude and Longitude points in the map ?ints

Can't get address from latitude and longitude

can't get location coordinates? latitude longitude

How do I extract the latitude, longitude and location name of the website with beautiful soup and python

How can i get my website to display as https://www

How to get my data from website so I can parse it?

How can I get my remote dockerised website to be accessible

TOP Ranking

HotTag

Archive