Login   Register  
PHP Classes
elePHPant
Icontem

File: example1.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of LlorenÁ Herrera  >  worldlocator  >  example1.php  >  Download  
File: example1.php
Role: Example script
Content type: text/plain
Description: Example 1
Class: worldlocator
Shows the location of a host in a world map.
Author: By
Last change: Some comments
Date: 12 years ago
Size: 1,356 bytes
 

Contents

Class file image Download
<HTML>
<HEAD>
<TITLE>Testing World IP Locator: Simple query, showing some HTML results</TITLE>
</HEAD>
<BODY>
<span style='font-size: 20px;'>Testing World IP Locator: Simple query, showing some HTML results</span><br>
<br>
<?

    
// Note: If you have downloaded this files from PHPClasses, you probably haven't the required image files, and you'll get an error. Go to http://phpspain.hexoplastia.com/projects/worldlocator to download a full packet with the required images.

    
include "worldlocator.inc.php";
    
    
// Creating worldlocator object
    
$worldlocator = new worldlocator;
    
    
// This class could act in different ways, this example is based on the simplest way: Only showing some information about the placement of the queried address in HTML format. See other examples.php for powerful image-generation
    
    // Querying our address and controlling possible errors
    
if (!$worldlocator->query ("62.22.120.174"))
        echo 
$worldlocator->geterror ();
    else
    {
        
// If there are no errors, show some information about the recently made query
        
echo "<b>Address queried:</b> ".$worldlocator->location["TARGET"]."<br>";
        echo 
"<b>Country:</b> ".$worldlocator->location["COUNTRY"]."<br>";
        echo 
"<b>Latitude / Longitude:</b>: ".$worldlocator->location["LAT"]." / ".$worldlocator->location["LONG"]."<br>";
    }

?>

</BODY>
</HTML>