Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

stream_context_create(3) [php man page]

STREAM_CONTEXT_CREATE(3)						 1						  STREAM_CONTEXT_CREATE(3)

stream_context_create - Creates a stream context

SYNOPSIS
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_DEFAULT(3)						 1					     STREAM_CONTEXT_SET_DEFAULT(3)

stream_context_set_default - Set the default stream context

SYNOPSIS
resource stream_context_set_default (array $options) DESCRIPTION
Set the default stream context which will be used whenever file operations (fopen(3), file_get_contents(3), etc...) are called without a context parameter. Uses the same syntax as stream_context_create(3). PARAMETERS
o $options - The options to set for the default context. Note $options must be an associative array of associative arrays in the format $arr['wrapper']['option'] = $value. RETURN VALUES
Returns the default stream context. EXAMPLES
Example #1 stream_context_set_default(3) example <?php $default_opts = array( 'http'=>array( 'method'=>"GET", 'header'=>"Accept-language: en " . "Cookie: foo=bar", 'proxy'=>"tcp://10.54.1.39:8000" ) ); $default = stream_context_set_default($default_opts); /* Sends a regular GET request to proxy server at 10.54.1.39 * For www.example.com using context options specified in $default_opts */ readfile('http://www.example.com'); ?> SEE ALSO
stream_context_create(3), stream_context_get_default(3), Listing of supported wrappers with context options ("Supported Protocols and Wrap- pers").. PHP Documentation Group STREAM_CONTEXT_SET_DEFAULT(3)
Man Page

6 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Unable to understand associative nature of awk arrays

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)
Discussion started by: nervous
3 Replies

2. Shell Programming and Scripting

Shell quiz: emulate an associative array

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)
Discussion started by: colemar
5 Replies

3. Shell Programming and Scripting

Problem with lookup values on AWK associative array

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)
Discussion started by: JasonHamm
2 Replies

4. Programming

Populating Associate Arrays in PHP

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)
Discussion started by: Neo
9 Replies

5. Shell Programming and Scripting

Using associative array for comparison

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)
Discussion started by: Decstasy
2 Replies

6. UNIX for Beginners Questions & Answers

Loading associative array from exported function

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)
Discussion started by: jcdole
1 Replies