Forum Moderators: coopster
function getLocationCaidaNetGeo($ip)
{
$url = "http://www.myiptest.com/staticpages/index.php/IP-Lookup/".$ip;
if($handle = fopen($url,r))
{
ob_start();
fpassthru($handle);
$htmlContent = ob_get_contents();
ob_end_clean();
fclose($handle);
}
preg_match ("/City:(.*)/i", $htmlContent, $temp) or die("Could not find user city!");
$city[0] = $temp[0];
return $city[0];
}
function getLocationCaidaNetGeo($ip)
{
$url = "http://www.myiptest.com/staticpages/index.php/IP-Lookup/".$ip;
$content = get_file_contents($url)
if ($content!==false)
{
//The code here should run through 'content' and pull out the city and return it.
preg_match ("/City:(.*)/i", $htmlContent, $temp) or die("Could not find user city!");
$city[0] = $temp[0]; //huh?
$output = $city;
}
else
{
//Error: URL/page could not be pulled/retrieved.
die('Could not retrieve data.');
}
return $output;
} <tr>
<td>City:</td>
<th>Glendale</th>
</tr>