diff --git a/reference/stream/functions/stream-context-create.xml b/reference/stream/functions/stream-context-create.xml index 0619b714d9..9ca64fd456 100644 --- a/reference/stream/functions/stream-context-create.xml +++ b/reference/stream/functions/stream-context-create.xml @@ -1,5 +1,5 @@ - + stream_context_create @@ -9,15 +9,45 @@ Description resourcestream_context_create - arrayparams + arrayoptions - Creates and returns a stream context with any parameters supplied in - params preset. + Creates and returns a stream context with any options supplied in + options preset. + + options must be an associative + array of associative arrays in the format + $arr['wrapper']['option'] = $value. + + + Using <function>stream_context_create</function> + +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); +?> +]]> + + See Also: - stream_context_set_params + stream_context_set_option, and + Listing of supported wrappers with context options ()