Manuel PHP

stream_context_set_default

(No version information available, might be only in CVS)

stream_context_set_defaultSet the default streams context

Description

resource stream_context_set_default ( array $options )

Set the default stream context which will be used whenever file operations (fopen(), file_get_contents(), etc...) are called without a context parameter. Uses the same syntax as stream_context_create().

Liste de paramètres

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.

Valeurs de retour

Returns the default stream context.

Exemples

Exemple #1 stream_context_set_default() example

  1. <?php
  2. $default_opts = array(  
  3. 'http'=>array( 
  4.    'method'=>"GET", 
  5.    'header'=>"Accept-language: en\r\n" . 
  6.          "Cookie: foo=bar", 
  7.    'proxy'=>"tcp://10.54.1.39:8000"  
  8. )  
  9. );  
  10.  
  11. $default = stream_context_set_default($default_opts);  
  12.  
  13. /* Sends a regular GET request to proxy server at 10.54.1.39
  14. * For www.example.com using context options specified in $default_opts
  15. */  
  16. readfile('http://www.example.com');  
  17. ?> 

Voir aussi


Remonter Remonter
L'éditeur javascript - CSS - Gentoo - Tutoriaux PHP - Tutoriels PHP - Bretagne - php - Moto - Kit graphique