<?php
// initiate curl and set options
$ipin = '69.72.129.3';
$ch = curl_init();
$ver = 'v1/';
$method = 'ipinfo/';
$apikey = '100.hva7qa7893wzcsc3x8dk';
$secret = 'uHZVvYK5';
$timestamp = gmdate('U'); // 1200603038
// echo $timestamp;
$sig = md5($apikey . $secret . $timestamp);
$service = 'http://api.quova.com/';
curl_setopt($ch, CURLOPT_URL, $service . $ver. $method. $ipin . '?apikey=' .
$apikey . '&sig='.$sig . '&format=xml');
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$data = curl_exec($ch);
$headers = curl_getinfo($ch);
// close curl
curl_close($ch);
// return XML data
if ($headers['http_code'] != '200') {
echo "An error has occurred accessing this IP";
return false;
} else {
//echo $data;
return($data);
}
i have neustar code it return ip info in xml format
i want to extract the data and assign it to variables like $ip , $org , $isp etc
so please help am not much famailer with xml i try to simplexml_load_string() but no success