stream_context_create 


php128 apg

CREATES a stream context.



<?php

res stream_context_create 
arr $options = ? , arr $params = ? )


where,

$options Must be an associative array of 
                                     associative arrays in the format
:
                 
                 
$arr['wrapper']['option'] = $value.

$params Must be an associative array in the format:

                 
$arr['parameter'] = $value
  
?>

 $options 


Must be an associative array.



 $params 


Must be an associative array.



 $options & $params 

 Context options and parameters  !



 STREAM WRAPPERS 


is an abstraction of a file system that allows PHP to use the same set of methods to access both local files and remote resources.

Provide a facility for managing and querying user-defined STREAM WRAPPERS.

In this system the registered STREAM WRAPPERS can be seen in the below table.



  1 EXERCISE   

<?php 

$f1 
=  'test'

$opts1 = [ 'http' => [ 'method'=>"POST"
                 
'header' => "Accept-language: en"
                 
'content' => $f1 ] ];

$cntxt1 stream_context_create($opts1);

var_dump($cntxt1);

echo 
'<br><br>or<br><br>';                  

$cntxt1a = (array)stream_context_create($opts1); 

foreach(
$cntxt1a as $k => $v); 
echo 
"$k => $v<bbr>";

echo 
'<br><br>'

?> 

 RESULT   

resource(9) of type (stream-context)

or

0 => Resource id #10