Thursday, September 6, 2012

Using ip address get all information

<?
$key="9dcde915a1a065fbaf14165f00fcc0461b8d0a6b43889614e8acdb8343e2cf15";
$ip= "203.124.23.133";
$url = "http://api.ipinfodb.com/v3/ip-city/?key=$key&ip=$ip&format=xml";
// load xml file
$xml = simplexml_load_file($url);
// print the name of the first element
echo $xml->getName() . "<br />";
// create a loop to print the element name and data for each node
foreach($xml->children() as $child)
  {
  echo $child->getName() . ": " . $child . "<br />";
  }
  ?>

No comments:

Post a Comment

Thank you for your Comment....

Popular Posts