<slide title="Streams and filters">

<break />

<example result="1"><![CDATA[<?php
    echo "<pre>";
	print_r(stream_get_wrappers());     
	print_r(stream_get_filters());     
	print_r(stream_get_transports());     
    echo "</pre>";
?>]]></example>

<example title="Examples" fontsize="1.4em"><![CDATA[<?php
readfile("php://filter/read=string.toupper/resource=http://www.example.com");

$fp = fopen("compress.zlib://foo-bar.txt.gz", "wb");

$httpsfile = file_get_contents("https://www.example.com/foo.txt");

$sock = fsockopen("ssl://secure.example.com", 443, $errno, $errstr, 30);

?>]]></example>

<example title="stream_copy_to_stream" fontsize="1.4em"><![CDATA[<?php
$src = fopen('http://www.example.com','r');
$dest1 = fopen('first1k.txt','w');
$dest2 = fopen('remainder.txt','w');

stream_copy_to_stream($src, $dest1, 1024);
stream_copy_to_stream($src, $dest2); 
?>]]></example>

<example title="file_put_contents" fontsize="1.4em"><![CDATA[<?php
$stream = fopen($url,'r');
$dest1 = fopen('first1k.txt','w');
stream_copy_to_stream($stream, $dest1, 1024);
file_put_contents('remainder.txt', $stream);
?>]]></example>
</slide>
