<?phpclass Geolocation01 extends Page { public function InitializeComponent() { parent::$PAGE_TITLE = "Tutorial : Latitude/Longitude Geolocation"; $geo = new GeoLocalisation(); // You need to create a key on the page: // http://ipinfodb.com/register.php $geo->setKey("IPINFODB_KEY"); $geo->askUserToSharePosition(); $geo->setRemoteIP(); $geo->getGeoLocation(); if ($geo->getLatitude() != "" && $geo->getLongitude() != "") { $this->render = new Label("You have been locate:<br/>" . "Latitude = " . round($geo->getLatitude(), 2) . "<br/>" . "Longitude = " . round($geo->getLongitude())); } else { $this->render = new Label("No Geolocation"); } }}?>