cvs: phpdoc /en/reference/stream/functions stream-context-create.xml

From: Date: Mon, 07 Apr 2003 23:32:46 +0000
Subject: cvs: phpdoc /en/reference/stream/functions stream-context-create.xml
Groups: php.doc 
Request: Send a blank email to phpdoc+get-969352493@lists.php.net to get a copy of this message
pollita Mon Apr 7 19:32:46 2003 EDT Modified files: /phpdoc/en/reference/stream/functions stream-context-create.xml Log: Include example usage of stream contexts Index: phpdoc/en/reference/stream/functions/stream-context-create.xml diff -u phpdoc/en/reference/stream/functions/stream-context-create.xml:1.1 phpdoc/en/reference/stream/functions/stream-context-create.xml:1.2 --- phpdoc/en/reference/stream/functions/stream-context-create.xml:1.1 Sat Jan 4 15:02:20 2003 +++ phpdoc/en/reference/stream/functions/stream-context-create.xml Mon Apr 7 19:32:46 2003 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.1 $ --> +<!-- $Revision: 1.2 $ --> <refentry id="function.stream-context-create"> <refnamediv> <refname>stream_context_create</refname> @@ -9,15 +9,45 @@ <title>Description</title> <methodsynopsis> <type>resource</type><methodname>stream_context_create</methodname> - <methodparam><type>array</type><parameter>params</parameter></methodparam> + <methodparam><type>array</type><parameter>options</parameter></methodparam> </methodsynopsis> <simpara> - Creates and returns a stream context with any parameters supplied in - <parameter>params</parameter> preset. + Creates and returns a stream context with any options supplied in + <parameter>options</parameter> preset. </simpara> <simpara> + <parameter>options</parameter> must be an associative + array of associative arrays in the format + <literal>$arr['wrapper']['option'] = $value</literal>. + </simpara> + <example> + <title>Using <function>stream_context_create</function></title> + <programlisting role="php"> +<![CDATA[ +<?php +$opts = array( + 'http'=>array( + 'method'=>"GET", + 'header'=>"Accept-language: en\r\n" . + "Cookie: foo=bar\r\n" + ) +); + +$context = stream_context_create($opts); + +/* Sends an http request to www.example.com + with additional headers shown above */ +$fp = fopen('http://www.example.com', 'r', false, $context); +fpassthru($fp); +fclose($fp); +?> +]]> + </programlisting> + </example> + <simpara> See Also: - <function>stream_context_set_params</function> + <function>stream_context_set_option</function>, and + Listing of supported wrappers with context options (<xref linkend="wrappers"/>) </simpara> </refsect1> </refentry>

« previous php.doc (#969352493) next »