PHP Class ManaPHP\Http\Client

Inheritance: extends ManaPHP\Component, implements ManaPHP\Http\ClientInterface
Datei anzeigen Open project: manaphp/manaphp

Protected Properties

Property Type Description
$_curlResponseHeader array
$_headers array
$_options array
$_peek boolean
$_responseBody string

Public Methods

Method Description
__construct ( array $options = [], array $headers = [] ) Client constructor.
_request ( string $type, string $url, string | array $data, array $headers, array $options ) : integer
delete ( array | string $url, array $headers = [], array $options = [] ) : integer
get ( array | string $url, array $headers = [], array $options = [] ) : integer
getResponseBody ( ) : string
patch ( array | string $url, string | array $data = [], array $headers = [], array $options = [] ) : integer
post ( array | string $url, string | array $data = [], array $headers = [], array $options = [] ) : mixed
put ( array | string $url, string | array $data = [], array $headers = [], array $options = [] ) : integer
setProxy ( string $proxy = '127.0.0.1:8888', boolean $peek = true ) : static

Protected Methods

Method Description
_buildUrl ( string | array $url ) : string
request ( string $type, string | array $url, string | array $data, array $headers, array $options ) : integer

Method Details

__construct() public method

Client constructor.
public __construct ( array $options = [], array $headers = [] )
$options array - `timeout`: How long should we wait for a response? (integer, seconds, default: 10) - `max_redirects`: How many times should we redirect 3xx before error? (integer, default: 10) (string, default: '') - `proxy`: Proxy details to use for proxy by-passing and authentication (string, default: '') - `ssl_certificates`: Should we verify SSL certificates? Allows passing in a custom certificate file as a string. (Using true uses the system-wide root certificate store instead, but this may have different behaviour across transports.) (string, default: 'xxx/ca.pem') - `verify_host`: Should we verify the common name in the SSL certificate? (bool: default, true)
$headers array - `User-Agent`: User Agent to send to the server (string, default: php-requests/$version)

_buildUrl() protected method

protected _buildUrl ( string | array $url ) : string
$url string | array
return string

_request() public method

public _request ( string $type, string $url, string | array $data, array $headers, array $options ) : integer
$type string
$url string
$data string | array
$headers array
$options array
return integer

delete() public method

public delete ( array | string $url, array $headers = [], array $options = [] ) : integer
$url array | string
$headers array
$options array
return integer

get() public method

public get ( array | string $url, array $headers = [], array $options = [] ) : integer
$url array | string
$headers array
$options array
return integer

getResponseBody() public method

public getResponseBody ( ) : string
return string

patch() public method

public patch ( array | string $url, string | array $data = [], array $headers = [], array $options = [] ) : integer
$url array | string
$data string | array
$headers array
$options array
return integer

post() public method

public post ( array | string $url, string | array $data = [], array $headers = [], array $options = [] ) : mixed
$url array | string
$data string | array
$headers array
$options array
return mixed

put() public method

public put ( array | string $url, string | array $data = [], array $headers = [], array $options = [] ) : integer
$url array | string
$data string | array
$headers array
$options array
return integer

request() protected method

protected request ( string $type, string | array $url, string | array $data, array $headers, array $options ) : integer
$type string
$url string | array
$data string | array
$headers array
$options array
return integer

setProxy() public method

public setProxy ( string $proxy = '127.0.0.1:8888', boolean $peek = true ) : static
$proxy string
$peek boolean
return static

Property Details

$_curlResponseHeader protected_oe property

protected array $_curlResponseHeader
return array

$_headers protected_oe property

protected array $_headers
return array

$_options protected_oe property

protected array $_options
return array

$_peek protected_oe property

protected bool $_peek
return boolean

$_responseBody protected_oe property

protected string $_responseBody
return string