Obsidian Age
New member
Heya there,
I currently have a PHP image that displays information about a visitor to my website. It used to grab City and Country information from ipinfodb.com but it no longer seems to do that. I was wondering if anyone can tell me why.
Here's the relevant section of the code:
$url = 'http://ipinfodb.com/ip_query.php?ip='.$ip;
$init = curl_init($url);
$visitor_host = @getHostByAddr( $ip );
curl_setopt($init, CURLOPT_RETURNTRANSFER, true);
curl_setopt($init, CURLOPT_TIMEOUT, 10);
$exec = curl_exec($init);
$info = curl_getinfo($init);
curl_close($init);
if($info['http_code'] === 200)
{
$objDOM = new DOMDocument();
$objDOM->loadXML($exec);
$country1 = $objDOM->getElementsByTagName("CountryName");
$country = $country1->item(0)->nodeValue;
$city1 = $objDOM->getElementsByTagName("City");
$city = $city1->item(0)->nodeValue;
}
...
imagestring ($im, $fontsize, 202, 86, "$city, $country", $text_color);
This USED to work, so perhaps ipinfodb has changed their column names? If someone can work out what is wrong with my code, or provid me with a new IP-lookup website that they know the column names for it would be greatly appreciated!
Cheers,
Obsidian_Age
I currently have a PHP image that displays information about a visitor to my website. It used to grab City and Country information from ipinfodb.com but it no longer seems to do that. I was wondering if anyone can tell me why.
Here's the relevant section of the code:
$url = 'http://ipinfodb.com/ip_query.php?ip='.$ip;
$init = curl_init($url);
$visitor_host = @getHostByAddr( $ip );
curl_setopt($init, CURLOPT_RETURNTRANSFER, true);
curl_setopt($init, CURLOPT_TIMEOUT, 10);
$exec = curl_exec($init);
$info = curl_getinfo($init);
curl_close($init);
if($info['http_code'] === 200)
{
$objDOM = new DOMDocument();
$objDOM->loadXML($exec);
$country1 = $objDOM->getElementsByTagName("CountryName");
$country = $country1->item(0)->nodeValue;
$city1 = $objDOM->getElementsByTagName("City");
$city = $city1->item(0)->nodeValue;
}
...
imagestring ($im, $fontsize, 202, 86, "$city, $country", $text_color);
This USED to work, so perhaps ipinfodb has changed their column names? If someone can work out what is wrong with my code, or provid me with a new IP-lookup website that they know the column names for it would be greatly appreciated!
Cheers,
Obsidian_Age