StreamContextFactory
in package
Allows the creation of a basic context supporting http proxy
Tags
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
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>