IClient

interface OCP\Http\Client\IClient
Interface IClient
Implemented by:OC\Http\Client\Client
Source:lib/public/Http/Client/IClient.php#35

Methods

public OCP\Http\Client\IClient::get($uri, $options=[])
Sends a GET request
Source:

lib/public/Http/Client/IClient.php#65

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,

Returns:

\OCP\Http\Client\IResponse

Throws:

\Exception If the request could not get completed

Since:

8.1.0

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

lib/public/Http/Client/IClient.php#90

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,

Returns:

\OCP\Http\Client\IResponse

Throws:

\Exception If the request could not get completed

Since:

8.1.0

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

lib/public/Http/Client/IClient.php#120

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,

Returns:

\OCP\Http\Client\IResponse

Throws:

\Exception If the request could not get completed

Since:

8.1.0

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

lib/public/Http/Client/IClient.php#150

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,

Returns:

\OCP\Http\Client\IResponse

Throws:

\Exception If the request could not get completed

Since:

8.1.0

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

lib/public/Http/Client/IClient.php#180

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,

Returns:

\OCP\Http\Client\IResponse

Throws:

\Exception If the request could not get completed

Since:

8.1.0

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

lib/public/Http/Client/IClient.php#210

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,

Returns:

\OCP\Http\Client\IResponse

Throws:

\Exception If the request could not get completed

Since:

8.1.0