<?php
echo "<pre>";
print_r(stream_get_wrappers());
print_r(stream_get_filters());
print_r(stream_get_transports());
echo "</pre>";
?>
Output
Array
(
[0] => https
[1] => ftps
[2] => compress.zlib
[3] => php
[4] => file
[5] => glob
[6] => data
[7] => http
[8] => ftp
[9] => phar
)
Array
(
[0] => zlib.*
[1] => string.rot13
[2] => string.toupper
[3] => string.tolower
[4] => convert.*
[5] => consumed
[6] => dechunk
[7] => convert.iconv.*
)
Array
(
[0] => tcp
[1] => udp
[2] => unix
[3] => udg
[4] => ssl
[5] => tls
[6] => tlsv1.0
[7] => tlsv1.1
[8] => tlsv1.2
[9] => tlsv1.3
)
Examples
<?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);
?>
stream_copy_to_stream
<?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);
?>
file_put_contents
<?php
$stream = fopen($url,'r');
$dest1 = fopen('first1k.txt','w');
stream_copy_to_stream($stream, $dest1, 1024);
file_put_contents('remainder.txt', $stream);
?>