WebSite-PHP Framework PHP
Multi language
Simple Ajax mode
No HTML, no JavaScript
URL rewriting
Mail sending
Sitemap - RSS - Web service
Download WebSite-PHP FrameWork now
 


Loading
 


Tutorial : Latitude/Longitude Geolocation

Tutorials

>

Tutorial Geolocation

>

Tutorial : Latitude/Longitude Geolocation


Geolocation-01: Tutorial of the composant Geolocation of the PHP FrameWork WebSite-PHP.

Tutorial : Latitude/Longitude Geolocation:

You have been locate:
Latitude = 39.96
Longitude = -83


Go back to tutorial of the componant Geolocation



Source code

Source code


File: /pages/tutorials/geolocation/geolocation-01.php

<?php
class 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");
        }
    }
}
?>


Go back to tutorial of the componant Geolocation


Share

 


Copyright © 2009-2024 WebSite-PHP Framework PHP
Home Documentation Download Quick start Tutorials Wiki Issue Tracker