WordPress and Geolocation

I have a homemade script on my blog’s header to record visitors and there geographical position in a mysql database. I have however run into problems with the hostip.info api. What I want to do is IP lookup each new guest and store their location in a database. I try to run a file() on the location of the ip lookup page on hostip and I get the following error:
Warning: file(http://api.hostip.info/get_html.php?ip=24.122.124.9): failed to open stream: No route to host in /home2/tales/public_html/wp-content/themes/default/header.php on line 63