\OCP\Http\ClientIClient

Interface IClient

Summary

Methods
Constants
get()
head()
post()
put()
delete()
options()
No constants found
No protected methods found
N/A
No private methods found
N/A

Methods

get()

get(string  $uri, array  $options = array()) : \OCP\Http\Client\IResponse

Sends a GET request

Parameters

string $uri
array $options

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 ], 'save_to' => '/path/to/file', // save to a file or a stream 'verify' => true, // bool or string to CA file 'debug' => true,

Throws

\Exception

If the request could not get completed

Returns

\OCP\Http\Client\IResponse

head()

head(string  $uri, array  $options = array()) : \OCP\Http\Client\IResponse

Sends a HEAD request

Parameters

string $uri
array $options

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 ], 'save_to' => '/path/to/file', // save to a file or a stream 'verify' => true, // bool or string to CA file 'debug' => true,

Throws

\Exception

If the request could not get completed

Returns

\OCP\Http\Client\IResponse

post()

post(string  $uri, array  $options = array()) : \OCP\Http\Client\IResponse

Sends a POST request

Parameters

string $uri
array $options

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 ], 'save_to' => '/path/to/file', // save to a file or a stream 'verify' => true, // bool or string to CA file 'debug' => true,

Throws

\Exception

If the request could not get completed

Returns

\OCP\Http\Client\IResponse

put()

put(string  $uri, array  $options = array()) : \OCP\Http\Client\IResponse

Sends a PUT request

Parameters

string $uri
array $options

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 ], 'save_to' => '/path/to/file', // save to a file or a stream 'verify' => true, // bool or string to CA file 'debug' => true,

Throws

\Exception

If the request could not get completed

Returns

\OCP\Http\Client\IResponse

delete()

delete(string  $uri, array  $options = array()) : \OCP\Http\Client\IResponse

Sends a DELETE request

Parameters

string $uri
array $options

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 ], 'save_to' => '/path/to/file', // save to a file or a stream 'verify' => true, // bool or string to CA file 'debug' => true,

Throws

\Exception

If the request could not get completed

Returns

\OCP\Http\Client\IResponse

options()

options(string  $uri, array  $options = array()) : \OCP\Http\Client\IResponse

Sends a options request

Parameters

string $uri
array $options

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 ], 'save_to' => '/path/to/file', // save to a file or a stream 'verify' => true, // bool or string to CA file 'debug' => true,

Throws

\Exception

If the request could not get completed

Returns

\OCP\Http\Client\IResponse