PhpRiot
Become Zend Certified

Prepare for the ZCE exam using our quizzes (web or iPad/iPhone). More info...


When you're ready get 7.5% off your exam voucher using voucher CJQNOV23 at the Zend Store

IP Location

This service allows you to retrieve location information for a given IP address.

There are some limitations:

  • The IP address must be in the T-Home network

  • Just the next big city will be resolved

  • IPv6 is not supported yet

Example 803. Locate a given IP

<?php
$service 
= new Zend_Service_DeveloperGarden_IpLocation($config);
$service->setEnvironment(
    
Zend_Service_DeveloperGarden_IpLocation::ENV_MOCK
);
$ip = new Zend_Service_DeveloperGarden_IpLocation_IpAddress('127.0.0.1');
print_r($service->locateIp($ip));

Zend Framework