Represents request that can be sent over HTTP(S)
More...
|
static | urlEncodeUri ($uri) |
| Urlencodes request URI (each part of path separately). Does not accept absolute request URI's or request URI's with parameters. More...
|
|
static | createFromUrl ($url, $url_encode_uri=true, $url_encode_params=true) |
| Creates WebRequest. More...
|
|
Represents request that can be sent over HTTP(S)
- Examples:
- redirection_interception.php, and response_interception.php.
__construct |
( |
|
$address, |
|
|
|
$port = 80 , |
|
|
|
$method = self::METHOD_GET , |
|
|
|
$request_uri = '/' , |
|
|
|
$url_encode = true |
|
) |
| |
Constructor.
See createFromUrl also.
Default Connection is Close, default HTTP version is 1.0.
Connection will be secure in case port is 443.
- Parameters
-
static createFromUrl |
( |
|
$url, |
|
|
|
$url_encode_uri = true , |
|
|
|
$url_encode_params = true |
|
) |
| |
|
static |
Creates WebRequest.
Default Connection is Close, default HTTP version is 1.0.
Connection will be secure in case port is 443.
- Parameters
-
string | $url | Full request url |
bool | $url_encode_uri | If true, request URI path portion will be urlencoded (see urlEncodeUri) |
bool | $url_encode_params | If true, all parameter names and values will be urlencoded automatically |
- Return values
-
- Exceptions
-
- Examples:
- basic_http_authentication.php, basic_http_request.php, basic_http_request_manager.php, basic_https_request.php, basic_proxy.php, http_cookies.php, http_file_upload.php, http_get_parameters.php, http_post_parameters.php, manual_http_authentication.php, proxy_authentication.php, proxy_chain.php, redirection_interception.php, response_interception.php, and timeouts.php.
Returns request address (hostname or IPv4 address).
- Return values
-
string | Request address (hostname or IPv4 address) |
Returns user-defined boundary for multipart/form-data requests.
- Return values
-
string | User-defined boundary or null, if boundary should be generated automatically. Default is null. Used only if request contains file attachments. |
getFullAddress |
( |
|
$include_params = true | ) |
|
Returns request HTTP header manager.
- Return values
-
Returns request HTTP parameter manager.
- Return values
-
Returns request port.
- Return values
-
Returns request URI.
- Return values
-
Returns request URI path portion.
Returns empty string in case of CONNECT method.
- Return values
-
string | Request URI path portion |
Returns true if request is secure (HTTPS).
- Return values
-
bool | True if request is secure (HTTPS) |
Sets request address (hostname or IPv4 address).
- Parameters
-
string | $address | Request address (hostname or IPv4 address) |
setBasicAuthenticationCredentials |
( |
|
$login, |
|
|
|
$password |
|
) |
| |
Adds basic authentication header.
- Parameters
-
string | $login | Login |
string | $password | Password |
Sets user-defined boundary for multipart/form-data requests.
- Parameters
-
string | $boundary | User-defined boundary or null, if boundary should be generated automatically. Default is null. Used only if request contains file attachments. |
setDigestAuthenticationCredentials |
( |
Array |
$auth_opts, |
|
|
|
$login, |
|
|
|
$password |
|
) |
| |
Adds digest authentication header.
- Parameters
-
- Exceptions
-
setHttpVersion |
( |
|
$version | ) |
|
Sets request port.
- Parameters
-
setRequestUri |
( |
|
$request_uri, |
|
|
|
$url_encode = true |
|
) |
| |
Sets request URI.
- Parameters
-
string | $request_uri | Request URI |
bool | $url_encode | If true, request URI string will be urlencoded |
Sets if request is secure (HTTPS).
- Parameters
-
bool | $secure | True to set request secure (HTTPS) |
static urlEncodeUri |
( |
|
$uri | ) |
|
|
static |
Urlencodes request URI (each part of path separately). Does not accept absolute request URI's or request URI's with parameters.
- Parameters
-
- Return values
-
string | Urlencoded request URI. |
Writes request to socket.
- Parameters
-
- Exceptions
-
The documentation for this class was generated from the following file: