Location: PHPKode > projects > phpCAMALEO > common/fun2inc/get_http_file.inc
<?php
if(!function_exists('get_http_file'))
{
	#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
	# Get contents of an external page
	#
	function get_http_file($host,$port,$doc,$timeout=30)
	#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
	{
		if(substr($doc,0,1)!='/') { $doc='/'.$doc; }
		$fp=@fsockopen($host,$port,$errno,$errstr,$timeout);
		if($fp)
		{
			@fputs($fp,'GET '.$doc.' HTTP/1.0'."\r\n".'Host: '.$host."\r\n\r\n");
			#
			#	Filter header 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_http_file) $errstr ($errno)\n"); }
	}
}
?>
Return current item: phpCAMALEO