Apply user-patch from David Tajchreber, closes PHP Bug #38802

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@295190 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
Joey Smith 2010-02-17 00:35:23 +00:00
parent 01cc4adcb1
commit 52846d4ff2

View file

@ -268,6 +268,36 @@ $context = stream_context_create($opts);
$result = file_get_contents('http://example.com/submit.php', false, $context);
?>
]]>
</programlisting>
</example><!-- }}} -->
</para>
<para>
<example xml:id="context.http.example-fetch-ignore-redirect"><!-- {{{ -->
<title>Ignore redirects but fetch headers and content </title>
<programlisting role="php">
<![CDATA[
<?php
$url = "http://www.example.org/header.php";
$opts = array(
'http' => array('method' => 'GET',
'max_redirects' => '0',
'ignore_errors' => '1')
);
$context = stream_context_create($opts);
$stream = fopen($url, 'r', false, $context);
// header information as well as meta data
// about the stream
var_dump(stream_get_meta_data($stream));
// actual data at $url
var_dump(stream_get_contents($stream));
fclose($stream);
?>
]]>
</programlisting>