Location: PHPKode > projects > phpCAMALEO > plugins/get_country.inc
<?php
global $country_server,$country_serverf;
#
$country_server='getcountry.grandolini.com'; $country_serverf='/';
include($_SESSION[skinf].'def/getcountryKEY.inc');
#
if(!function_exists('get_country'))
{
	#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
	function get_country($host,$page,$timeout=5)
	#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
	{
		$fp=@fsockopen($host,80,$errno,$errstr,$timeout);
		if($fp)
		{
			@fputs($fp,'GET '.$page.' HTTP/1.0'."\r\n".'Host: '.$host."\r\n\r\n");
			#
			#	filters headers out
			#
			$header=true;
			while(!feof($fp) && $header==true)
			{
				$httpresult=@fgets($fp,1024);
				if(ereg("^\r\n",$httpresult)) { $header=false; }
			}
			#
			#	get data
			#
			while(!feof($fp)) { $raw.=@fgets($fp,1024); }
			@fclose($fp);
			return($raw);
		}
		else { return('get_country => '.$errstr.' ('.$errno.') '."\t\t\t\n"); }
	}
}
?>
Return current item: phpCAMALEO