pbms_write_stream
Description
pbms_write_stream ( php_stream $output_stream, string $blob_ref [,resource $pbms] )
Get data from the PBMS BLOB streaming server for the specified BLOB reference.

The BLOB data is written to the provided stream as it is read in from the PBMS BLOB streaming server. The stream can be any type of stream that supports the 'write' operation.

Parameters
$output_stream
A stream to which the BLOB data received from the PBMS server is written. The stream must support the 'write' operation.
$blob_ref
A BLOB reference for the data to be received.
$pbms
A valid PBMS connection resource. If $pbms is not specified, the last link opened by pbms_connect() is assumed. If no such link is found, it will try to create one as if pbms_connect() was called with no arguments. If by chance no connection is found or established, an E_WARNING level error is generated.
Return Values

Returns TRUE on success.

Returns FALSE on failure. Use pbms_errno() and pbms_error() to retrieve error details.

Example
<?php 
	pbms_connect();

	//-----------
	// Create a BLOB and insert it into a table.
	// Assume that the table exists.
	$fh = fopen("MyBLOB", "r");
	$blob_ref = pbms_read_stream($fh, filesize("MyBLOB"));
	fclose($fh);
	
	query =  sprintf("insert into bobtest(id, name) Values(1, \"%s\")", $blob_ref);
	mysql_query($query);
	
	// Fetch the BLOB back again.
	$result =mysql_query("select name from bobtest where id = 1");
			
	$row = mysql_fetch_row($result);
	printf("NOTE: blob ref stored in table: \"%s\" is not the same as what was inserted \"%s\" \n", $row[0], $blob_ref)

	$fh = fopen("MyBLOB.out", "w+");
	pbms_write_stream($fh, $row[0]);
	fclose($fh);

	pbms_close();
?>
		
Related functions
pbms_write_stream_range() pbms_get_data() pbms_get_data_range() pbms_put_data() pbms_read_stream()