mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-16 00:48:54 +00:00
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:
parent
01cc4adcb1
commit
52846d4ff2
1 changed files with 30 additions and 0 deletions
|
@ -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>
|
||||
|
|
Loading…
Reference in a new issue