Filters the options that should be passed to the stream_context_create() function.
$opts (array) (required) Options to pass to stream_context_create().
$app = \Liten\Liten::getInstance(); function http_proxy_authentication($opts) { $username = 'proxy_username'; $password = 'proxy_password'; $auth = base64_encode("$username:$password"); $opts = [ 'http' => [ 'proxy' => 'tcp://127.0.0.1:8080', 'request_fulluri' => true, 'header' => "Proxy-Authorization: Basic $auth" ] ]; return $opts; } $app->hook->add_filter('stream_context_create_options', 'http_proxy_authentication', 10, 1);
Since 6.2.4
stream_context_create_options hook is located in app/src/functions/core-function.php.