586 Part IV: Using PHP for Sysadmin Tasks (Web hosting support)

586 Part IV: Using PHP for Sysadmin Tasks This script requires the netgeo.php class. It works as follows: . It gets a list of IP addresses or host names from the command line using the getHostList() function. . For each given IP or host name, it performs netgeo lookup using findLocation(), which prints the geographic data available for the given IP or host name. Note that not all IP addresses or host names are in the netgeo database, so a result might not always be available. Here are some example runs of this script: $ ./geolocator.php www.yahoo.com www.yahoo.com: Approximate location: City : SUNNYVALE State :CALIFORNIA Country :US Longitude:122degree West Latitude:37.4degree North You can see that www.yahoo.com appears to be located in Sunnyvale, CA, U.S. Following is another example: $./geolocator.php www.amazon.com www.amazon.com:Approximate location: City : SEATTLE State :WASHINGTON Country :US Longitude:122.31degree West Latitude:47.55degree North In the preceding example, you can see that www.amazon.com appears to be located in Seattle, Washington, U.S. One last example: $./geolocator.php www.csus.edu www.csus.edu: Approximate location: City : SACRAMENTO State :CALIFORNIA Country :US Longitude:121.44degree West Latitude:38.57degree North

Leave a Reply