public static function OpenRemoteDocument($url)
	{
		// Expression Regular:
		// [1]: http or ftp
		// [2]: Server name
		// [4]: Full Path
		$pat = '/(http|ftp|https):\\/\\/((\\w|\\.)+)/i';
		$urlParts = preg_split($pat, $url, -1,PREG_SPLIT_DELIM_CAPTURE);

		$handle = fsockopen($urlParts[2], 80, $errno, $errstr, 30);
		if (!$handle)
		{
			throw new FileUtilException("Socket error: $errstr ($errno)");
		}
		else
		{
			$out = "GET " . $urlParts[4] . " HTTP/1.1\r\n";
			$out .= "Host: " . $urlParts[2] . "\r\n";
			$out .= "Connection: Close\r\n\r\n";

			fwrite($handle, $out);

			return $handle;
		}
	}
public static function OpenRemoteDocument($url)
	{
		// Expression Regular:
		// [1]: http or ftp
		// [2]: Server name
		// [4]: Full Path
		$pat = '/(http|ftp|https):\\/\\/((\\w|\\.)+)/i';
		$urlParts = preg_split($pat, $url, -1,PREG_SPLIT_DELIM_CAPTURE);

		$handle = fsockopen($urlParts[2], 80, $errno, $errstr, 30);
		if (!$handle)
		{
			throw new FileUtilException("Socket error: $errstr ($errno)");
		}
		else
		{
			$out = "GET " . $urlParts[4] . " HTTP/1.1\r\n";
			$out .= "Host: " . $urlParts[2] . "\r\n";
			$out .= "Connection: Close\r\n\r\n";

			fwrite($handle, $out);

			return $handle;
		}
	}
public static function OpenRemoteDocument ( $ url ) { // Expression Regular: // [1]: http or ftp // [2]: Server name // [4]: Full Path $ pat = '/(http|ftp|https):\\/\\/((\\w|\\.)+)/i' ; $ urlParts = preg_split ( $ pat , $ url , - 1 , PREG_SPLIT_DELIM_CAPTURE ) ; $ handle = fsockopen ( $ urlParts [ 2 ] , 80 , $ errno , $ errstr , 30 ) ; if ( ! $ handle ) { throw new FileUtilException ( "Socket error: $errstr ($errno)" ) ; } else { $ out = "GET " . $ urlParts [ 4 ] . " HTTP/1.1\r\n" ; $ out .= "Host: " . $ urlParts [ 2 ] . "\r\n" ; $ out .= "Connection: Close\r\n\r\n" ; fwrite ( $ handle , $ out ) ; return $ handle ; } }
Open a remote document from a specific URL
@param string $url
@return handle Handle of the document opened
Open a remote document from a specific URL