Location: PHPKode > scripts > HTTP class > http-class/http.php
<?php

class CHttp
{
	var $user;
	var $pass;
	var $server;

	function CHttp()
	{
		$user = "";
		$pass = "";
		$server = "";
	}
	
	function RequestFile($file, &$response, $array = NULL)
	{
		$flag = false;
		$httpFile = "http://";
		if (!empty($this->user))
		{
			$httpFile .= htmlentities(urlencode($this->user));
			$httpFile .= ":";
			$httpFile .= htmlentities(urlencode($this->pass));
			$httpFile .= "@";
		}
		$httpFile .= $this->server;
		$httpFile .= $file;
		if (!empty($array))
		{
			$bFirst = true;
			foreach ($array as $key => $value)
			{
				if ($bFirst)
				{
					$httpFile .= "?";
					$bFirst = false;
				}
				else $httpFile .= "&";
				$httpFile .= $key;
				$httpFile .= "=";
				$httpFile .= htmlentities(urlencode($value));
			}
		}
		$response = file_get_contents($httpFile);
		if (!empty($response))
			$flag = true;
		return $flag;
	}
}
?>
Return current item: HTTP class