Class rex_socket
Class for sockets.
Example:
try { $socket = rex_socket::factory('www.example.com'); $socket->setPath('/url/to/my/resource?param=1'); $response = $socket->doGet(); if($response->isOk()) { $body = $response->getBody(); } } catch(rex_socket_exception $e) { // error message: $e->getMessage() }
Direct known subclasses
Methods summary
protected
|
||
public static
static
|
||
public static
static
|
||
public
mixed
|
||
public
mixed
|
||
public
mixed
|
#
addBasicAuthorization( string $user, string $password )
Adds the basic authorization header to the current request. |
|
public
mixed
|
||
public
mixed
|
#
followRedirects( false|integer $redirects )
Sets number of redirects that should be followed automatically. |
|
public
|
||
public
|
||
public
|
||
public
|
||
protected
|
||
protected
|
#
writeRequest( string $method, string $path, array $headers = [], string|callable $data = '' )
Writes a request to the opened connection. |
|
protected static
array
|
Properties summary
protected
mixed
|
$host
|
|
protected
mixed
|
$port
|
|
protected
mixed
|
$ssl
|
|
protected
string
|
$path
|
# '/' |
protected
integer
|
$timeout
|
# 15 |
protected
boolean
|
$followRedirects
|
# false |
protected
array
|
$headers
|
# [] |
protected
mixed
|
$stream
|