Client

class OC\Http\Client\Client
Class Client
Source:lib/private/Http/Client/Client.php#50
Implements:OCP\Http\Client\IClient

Properties

Methods

public OC\Http\Client\Client::__construct($config, $logger, $certificateManager, $client, $localAddressChecker)
Source:lib/private/Http/Client/Client.php#62
protected OC\Http\Client\Client::preventLocalAddress($uri, $options)
Source:lib/private/Http/Client/Client.php#185
public OC\Http\Client\Client::get($uri, $options=[])
Sends a GET request
Source:

lib/private/Http/Client/Client.php#222

Parameters:
  • $uri (string)
  • $options (array) Array such as
‘query’ => [

‘field’ => ‘abc’, ‘other_field’ => ‘123’, ‘file_name’ => fopen(‘/path/to/file’, ‘r’),

], ‘headers’ => [

‘foo’ => ‘bar’,

], ‘cookies’ => [‘

‘foo’ => ‘bar’,

], ‘allow_redirects’ => [

‘max’ => 10, // allow at most 10 redirects. ‘strict’ => true, // use “strict” RFC compliant redirects. ‘referer’ => true, // add a Referer header ‘protocols’ => [‘https’] // only allow https URLs

], ‘sink’ => ‘/path/to/file’, // save to a file or a stream ‘verify’ => true, // bool or string to CA file ‘debug’ => true, ‘timeout’ => 5,

Returns:

\OCP\Http\Client\IResponse

Throws:

\Exception If the request could not get completed

public OC\Http\Client\Client::head($uri, $options=[])
Sends a HEAD request
Source:

lib/private/Http/Client/Client.php#253

Parameters:
  • $uri (string)
  • $options (array) Array such as
‘headers’ => [

‘foo’ => ‘bar’,

], ‘cookies’ => [‘

‘foo’ => ‘bar’,

], ‘allow_redirects’ => [

‘max’ => 10, // allow at most 10 redirects. ‘strict’ => true, // use “strict” RFC compliant redirects. ‘referer’ => true, // add a Referer header ‘protocols’ => [‘https’] // only allow https URLs

], ‘sink’ => ‘/path/to/file’, // save to a file or a stream ‘verify’ => true, // bool or string to CA file ‘debug’ => true, ‘timeout’ => 5,

Returns:

\OCP\Http\Client\IResponse

Throws:

\Exception If the request could not get completed

public OC\Http\Client\Client::post($uri, $options=[])
Sends a POST request
Source:

lib/private/Http/Client/Client.php#288

Parameters:
  • $uri (string)
  • $options (array) Array such as
‘body’ => [

‘field’ => ‘abc’, ‘other_field’ => ‘123’, ‘file_name’ => fopen(‘/path/to/file’, ‘r’),

], ‘headers’ => [

‘foo’ => ‘bar’,

], ‘cookies’ => [‘

‘foo’ => ‘bar’,

], ‘allow_redirects’ => [

‘max’ => 10, // allow at most 10 redirects. ‘strict’ => true, // use “strict” RFC compliant redirects. ‘referer’ => true, // add a Referer header ‘protocols’ => [‘https’] // only allow https URLs

], ‘sink’ => ‘/path/to/file’, // save to a file or a stream ‘verify’ => true, // bool or string to CA file ‘debug’ => true, ‘timeout’ => 5,

Returns:

\OCP\Http\Client\IResponse

Throws:

\Exception If the request could not get completed

public OC\Http\Client\Client::put($uri, $options=[])
Sends a PUT request
Source:

lib/private/Http/Client/Client.php#328

Parameters:
  • $uri (string)
  • $options (array) Array such as
‘body’ => [

‘field’ => ‘abc’, ‘other_field’ => ‘123’, ‘file_name’ => fopen(‘/path/to/file’, ‘r’),

], ‘headers’ => [

‘foo’ => ‘bar’,

], ‘cookies’ => [‘

‘foo’ => ‘bar’,

], ‘allow_redirects’ => [

‘max’ => 10, // allow at most 10 redirects. ‘strict’ => true, // use “strict” RFC compliant redirects. ‘referer’ => true, // add a Referer header ‘protocols’ => [‘https’] // only allow https URLs

], ‘sink’ => ‘/path/to/file’, // save to a file or a stream ‘verify’ => true, // bool or string to CA file ‘debug’ => true, ‘timeout’ => 5,

Returns:

\OCP\Http\Client\IResponse

Throws:

\Exception If the request could not get completed

public OC\Http\Client\Client::delete($uri, $options=[])
Sends a DELETE request
Source:

lib/private/Http/Client/Client.php#363

Parameters:
  • $uri (string)
  • $options (array) Array such as
‘body’ => [

‘field’ => ‘abc’, ‘other_field’ => ‘123’, ‘file_name’ => fopen(‘/path/to/file’, ‘r’),

], ‘headers’ => [

‘foo’ => ‘bar’,

], ‘cookies’ => [‘

‘foo’ => ‘bar’,

], ‘allow_redirects’ => [

‘max’ => 10, // allow at most 10 redirects. ‘strict’ => true, // use “strict” RFC compliant redirects. ‘referer’ => true, // add a Referer header ‘protocols’ => [‘https’] // only allow https URLs

], ‘sink’ => ‘/path/to/file’, // save to a file or a stream ‘verify’ => true, // bool or string to CA file ‘debug’ => true, ‘timeout’ => 5,

Returns:

\OCP\Http\Client\IResponse

Throws:

\Exception If the request could not get completed

public OC\Http\Client\Client::options($uri, $options=[])
Sends a options request
Source:

lib/private/Http/Client/Client.php#398

Parameters:
  • $uri (string)
  • $options (array) Array such as
‘body’ => [

‘field’ => ‘abc’, ‘other_field’ => ‘123’, ‘file_name’ => fopen(‘/path/to/file’, ‘r’),

], ‘headers’ => [

‘foo’ => ‘bar’,

], ‘cookies’ => [‘

‘foo’ => ‘bar’,

], ‘allow_redirects’ => [

‘max’ => 10, // allow at most 10 redirects. ‘strict’ => true, // use “strict” RFC compliant redirects. ‘referer’ => true, // add a Referer header ‘protocols’ => [‘https’] // only allow https URLs

], ‘sink’ => ‘/path/to/file’, // save to a file or a stream ‘verify’ => true, // bool or string to CA file ‘debug’ => true, ‘timeout’ => 5,

Returns:

\OCP\Http\Client\IResponse

Throws:

\Exception If the request could not get completed