diff --git a/BridgeAbstract.md b/BridgeAbstract.md index 46b464b..4dbef9d 100644 --- a/BridgeAbstract.md +++ b/BridgeAbstract.md @@ -255,8 +255,7 @@ switch($this->queriedContext){ # Helper functions -Helper functions are independent function that help you to manage specific events in your bridges. -It is considered good practice to use them rather than implementing equivalent features directly in your bridges. +Helper functions are independent functions that help you to manage specific events in your bridges. * [`returnError`](#the-returnerror-function) * [`returnClientError`](#the-returnclienterror-function) @@ -299,10 +298,18 @@ Use this function when a problem occurs that has nothing to do with the paramete ## The `getContents` function -This function is a wrapper arround the [file_get_contents](https://secure.php.net/manual/en/function.file-get-contents.php) original PHP function. It downloads the content of a given URI while respecting the various settings defined at a global level by RSS-Bridge (i.e., proxy host, user agent, etc.). It does accept all the parameters of the original [file_get_contents](https://secure.php.net/manual/en/function.file-get-contents.php) function. +This function uses [cURL](https://secure.php.net/manual/en/book.curl.php) to acquire data from the specified URI while respecting the various settings defined at a global level by RSS-Bridge (i.e., proxy host, user agent, etc.). This function accepts a few parameters: + +| Parameter | Type | Optional | Description +| --------- | ------ | ---------- | ---------- +| `url` | string | *required* | The URL of the contents to acquire +| `header` | array | *optional* | An array of HTTP header fields to set, in the format `array('Content-type: text/plain', 'Content-length: 100')`, see [CURLOPT_HTTPHEADER](https://secure.php.net/manual/en/function.curl-setopt.php) +| `opts` | array | *optional* | An array of cURL options in the format `array(CURLOPT_POST => 1);`, see [curl_setopt](https://secure.php.net/manual/en/function.curl-setopt.php) for a complete list of options. ```PHP -$html = getContents('your URI'); +$header = array('Content-type:text/plain', 'Content-length: 100'); +$opts = array(CURLOPT_POST => 1); +$html = getContents($url, $header, $opts); ``` ## The `getSimpleHTMLDOM` function