Warning
When reading from anything that is not a regular local file, such as
streams returned when
reading remote files or from
popen() and fsockopen(), reading
will stop after a packet is available. This means that you should
collect the data together in chunks as shown in the examples below.
<?php
$handle = fopen("http://www.example.com/", "rb");
$contents = stream_get_contents($handle);
fclose($handle);
?>
<?php
$handle = fopen("http://www.example.com/", "rb");
$contents = '';
while (!feof($handle)) {
$contents .= fread($handle, 8192);
}
fclose($handle);
?>