STREAM_CONTEXT_CREATE(3) 1 STREAM_CONTEXT_CREATE(3)stream_context_create - Creates a stream contextSYNOPSIS
resource stream_context_create ([array $options], [array $params])
DESCRIPTION
Creates and returns a stream context with any options supplied in $options preset.
PARAMETERS
o $options
- Must be an associative array of associative arrays in the format $arr['wrapper']['option'] = $value. Default to an empty array.
o $params
- Must be an associative array in the format $arr['parameter'] = $value. Refer to context parameters for a listing of standard
stream parameters.
RETURN VALUES
A stream context resource.
CHANGELOG
+--------+---------------------------------------+
|Version | |
| | |
| | Description |
| | |
+--------+---------------------------------------+
| 5.3.0 | |
| | |
| | Added the optional $params argument. |
| | |
+--------+---------------------------------------+
EXAMPLES
Example #1
Using stream_context_create(3)
<?php
$opts = array(
'http'=>array(
'method'=>"GET",
'header'=>"Accept-language: en
" .
"Cookie: foo=bar
"
)
);
$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_option(3), Listing of supported wrappers ("Supported Protocols and Wrappers"), Context options ("Context options and
parameters").
PHP Documentation Group STREAM_CONTEXT_CREATE(3)
Check Out this Related Man Page
STREAM_CONTEXT_SET_PARAMS(3) 1 STREAM_CONTEXT_SET_PARAMS(3)stream_context_set_params - Set parameters for a stream/wrapper/context
SYNOPSIS
bool stream_context_set_params (resource $stream_or_context, array $params)
DESCRIPTION
Sets parameters on the specified context.
PARAMETERS
o $stream_or_context
- The stream or context to apply the parameters too.
o $params
- An array of parameters to set.
Note
$params should be an associative array of the structure: $params['paramname'] = "paramvalue";.
SUPPORTED PARAMETERS
+-------------+---------------------------------------------------+
| Parameters | |
| | |
| | Purpose |
| | |
+-------------+---------------------------------------------------+
| | |
|notification | |
| | |
| | Name of user-defined callback function to be |
| | called whenever a stream triggers a notification. |
| | |
| | |
| options | |
| | |
| | Array of options as in context options and |
| | parameters. |
| | |
+-------------+---------------------------------------------------+
RETURN VALUES
Returns TRUE on success or FALSE on failure.
SEE ALSO stream_notification_callback(3).
PHP Documentation Group STREAM_CONTEXT_SET_PARAMS(3)
About associative nature of awk arrays i'm still confused, not able to understand yet how array element can be accessed based on a string, I got one example at gawk manual to illustrate associative nature of awk arrays, it goes here:
Codeawk '
# Print list of word frequencies
{
for (i = 1;... (3 Replies)
Most shells flavors do not have associative arrays a.k.a. maps.
How would you emulate an associative array?
I had this problem once and found a working solution, but I don't want to spoil the game hence I wont tell it.
Wonder if anyone comes up with something better. (5 Replies)
I'm at wits end with this issue and my troubleshooting leads me to believe it is a problem with the file formatting of the array referenced by my script:
awk -F, '{if (NR==FNR) {a=$4","$3","$2}\
else {print a "," $0}}' WBTSassignments1.txt RNCalarms.tmp
On the WBTSassignments1.txt file... (2 Replies)
I'm not very good at associative arrays; and working on this PHP code has got me a bit stumped. My goal is to populate a (multidimensional) associative array in a PHP while look after a MySQL query. The code fragment looks like this:
while($campaign_row = mysql_fetch_array($campaigninfo))
{
... (9 Replies)
Hello together,
i make something wrong... I want an array that contains information to associate it for further processing.
Here is something from my bash... You will know, what I'm trying to do.
I have to point out in advance, that the variable $SYSOS is changing and not as static as in my... (2 Replies)
Hello.
I have an export of an associative array build using declare -p SOME_ARRAY_NAME > SOME_FILE_NAME.txt.
Producing some thing like declare -A SOME_ARRAY_NAME=( ="some_text" ="a_text" ......... ="another_text" ) in a text file.
I have a stock of functions which are sourced from... (1 Reply)