X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FNetwork%2FIHTTPClient.php;h=0b51d6480e433d6b6fa7a3741096d14e84f28879;hb=865006682a3952565035207898b80dfbd6d390b1;hp=180908eede4dd449115e20f6e42a49468343441d;hpb=8385ee7a612b33c2e2af2533d922f4a8a21e6dd4;p=friendica.git diff --git a/src/Network/IHTTPClient.php b/src/Network/IHTTPClient.php index 180908eede..0b51d6480e 100644 --- a/src/Network/IHTTPClient.php +++ b/src/Network/IHTTPClient.php @@ -21,6 +21,8 @@ namespace Friendica\Network; +use GuzzleHttp\Exception\TransferException; + /** * Interface for calling HTTP requests and returning their responses */ @@ -60,8 +62,8 @@ interface IHTTPClient * Send a HEAD to an URL. * * @param string $url URL to fetch - * @param array $opts (optional parameters) assoziative array with: - * 'accept_content' => supply Accept: header with 'accept_content' as the value + * @param array $opts (optional parameters) associative array with: + * 'accept_content' => (string array) supply Accept: header with 'accept_content' as the value * 'timeout' => int Timeout in seconds, default system config value or 60 seconds * 'cookiejar' => path to cookie jar file * 'header' => header array @@ -74,8 +76,8 @@ interface IHTTPClient * Send a GET to an URL. * * @param string $url URL to fetch - * @param array $opts (optional parameters) assoziative array with: - * 'accept_content' => supply Accept: header with 'accept_content' as the value + * @param array $opts (optional parameters) associative array with: + * 'accept_content' => (string array) supply Accept: header with 'accept_content' as the value * 'timeout' => int Timeout in seconds, default system config value or 60 seconds * 'cookiejar' => path to cookie jar file * 'header' => header array @@ -85,6 +87,24 @@ interface IHTTPClient */ public function get(string $url, array $opts = []); + /** + * Sends a HTTP request to a given url + * + * @param string $method A HTTP request + * @param string $url Url to send to + * @param array $opts (optional parameters) associative array with: + * 'body' => (mixed) setting the body for sending data + * 'accept_content' => (string array) supply Accept: header with 'accept_content' as the value + * 'timeout' => int Timeout in seconds, default system config value or 60 seconds + * 'cookiejar' => path to cookie jar file + * 'header' => header array + * 'content_length' => int maximum File content length + * 'auth' => array authentication settings + * + * @return IHTTPResult + */ + public function request(string $method, string $url, array $opts = []); + /** * Send POST request to an URL * @@ -106,8 +126,8 @@ interface IHTTPClient * @param string $url A user-submitted URL * * @return string A canonical URL - * @throws \Friendica\Network\HTTPException\InternalServerErrorException - * @see ParseUrl::getSiteinfo + * + * @throws TransferException In case there's an error during the resolving */ public function finalUrl(string $url); }