I currently have some geolocation jquery code to take my Google AJAX API, get values like loc.address.city and loc.address.region and write to a cookie to wherever I am including the area and state. For example:
// Using Google API, determine visitors area and set cookie for later retrieval
jQuery(document).ready(function() {
var location = 'Unable to determine your location.';
if (google.loader.ClientLocation) {
var loc = google.loader.ClientLocation;
var cookieNameA = "area_name"; // Cookie for area
var nDays = 5; // Num of Days before cookie expires
var today = new Date();
var expire = new Date();
if (nDays==null || nDays==0) nDays=1;
expire.setTime(today.getTime() + 3600000*24*nDays);
document.cookie = cookieNameA+"="+ loc.address.city
+ ";expires="+expire.toGMTString();
}
});
The deal is I want to do all of the cookie writing in PHP but it is extremely hard to find any type of documentation on their site or anyone else’s. How would I get the loc.address.city and loc.address.region in PHP language instead of Javascript from their API?