PHP.nl

stream_context_set_options

stream_context_set_options

Sets options on the specified context

true **stream_context_set_options** resource $context array $options

Sets options on the specified context.

contextThe stream or context resource to apply the options to.

options The options to set for . context

Opmerking: > must be an associative array of associative arrays in the format . options``$array['wrapper']['option'] = $value

    Refer to 
    for a listing of stream options.
   context options and parameters

return.success

Voorbeeld: example

<?php

$context = stream_context_create();

$options = [
    'http' => [
        'protocol_version' => 1.1,
        'user_agent' => 'PHPT Agent',
    ],
];

stream_context_set_options($context, $options);
var_dump(stream_context_get_options($context));
?>
array(1) {
  ["http"]=>
  array(2) {
    ["protocol_version"]=>
    float(1.1)
    ["user_agent"]=>
    string(10) "PHPT Agent"
  }
}

stream_context_set_option