Documentation

StreamContextFactory
in package

Allows the creation of a basic context supporting http proxy

Tags
author

Jordan Alliot jordan.alliot@gmail.com

author

Markus Tacker m@coderbyheart.de

Table of Contents

getContext()  : resource
Creates a context supporting HTTP proxies
fixHttpHeaderField()  : array<string|int, mixed>
A bug in PHP prevents the headers from correctly being sent when a content-type header is present and NOT at the end of the array

Methods

getContext()

Creates a context supporting HTTP proxies

public static getContext(string $url[, array<string|int, mixed> $defaultOptions = array() ][, array<string|int, mixed> $defaultParams = array() ]) : resource
Parameters
$url : string

URL the context is to be used for

$defaultOptions : array<string|int, mixed> = array()

Options to merge with the default

$defaultParams : array<string|int, mixed> = array()

Parameters to specify on the context

Tags
throws
RuntimeException

if https proxy required and OpenSSL uninstalled

Return values
resource

Default context

fixHttpHeaderField()

A bug in PHP prevents the headers from correctly being sent when a content-type header is present and NOT at the end of the array

private static fixHttpHeaderField(string|array<string|int, mixed> $header) : array<string|int, mixed>

This method fixes the array by moving the content-type header to the end

Parameters
$header : string|array<string|int, mixed>
Tags
link
https://bugs.php.net/bug.php?id=61548
Return values
array<string|int, mixed>

Search results