Location: PHPKode > projects > FarODP > farodp/includes/common/ReadURL.php
<?php

function readURL($url, $host, &$str)
{
    if ((strpos($url, array("\n", "\r", " ", "\t")) !== false) ||
		strpos($host, array("\n", "\r", " ", "\t")) !== false) {
        trigger_error("The URL cannot contain spaces.");
    }

    $out = '';
	$fp = fsockopen($host, 80, $errno, $errstr, 5);

	if ($fp === false)
	{
	    return false;
	}
	else
	{
		$out = 'GET /' . $url . ' HTTP/1.1' . "\r\n";
		$out .= "Host: $host\r\n";
		$out .= 'Connection: Close' . "\r\n\r\n";

		fwrite($fp, $out);

		while (!feof($fp))
		{
			$out .= fgets($fp, 8192);
		}

		fclose($fp);

		$section = explode("\r\n\r\n", $out, 2);
		$str = $section[1];
	}

	return true;
}

?>
Return current item: FarODP