diff options
Diffstat (limited to 'application/http/HttpAccess.php')
-rw-r--r-- | application/http/HttpAccess.php | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/application/http/HttpAccess.php b/application/http/HttpAccess.php new file mode 100644 index 00000000..646a5264 --- /dev/null +++ b/application/http/HttpAccess.php | |||
@@ -0,0 +1,47 @@ | |||
1 | <?php | ||
2 | |||
3 | declare(strict_types=1); | ||
4 | |||
5 | namespace Shaarli\Http; | ||
6 | |||
7 | /** | ||
8 | * Class HttpAccess | ||
9 | * | ||
10 | * This is mostly an OOP wrapper for HTTP functions defined in `HttpUtils`. | ||
11 | * It is used as dependency injection in Shaarli's container. | ||
12 | * | ||
13 | * @package Shaarli\Http | ||
14 | */ | ||
15 | class HttpAccess | ||
16 | { | ||
17 | public function getHttpResponse( | ||
18 | $url, | ||
19 | $timeout = 30, | ||
20 | $maxBytes = 4194304, | ||
21 | $curlHeaderFunction = null, | ||
22 | $curlWriteFunction = null | ||
23 | ) { | ||
24 | return get_http_response($url, $timeout, $maxBytes, $curlHeaderFunction, $curlWriteFunction); | ||
25 | } | ||
26 | |||
27 | public function getCurlDownloadCallback( | ||
28 | &$charset, | ||
29 | &$title, | ||
30 | &$description, | ||
31 | &$keywords, | ||
32 | $retrieveDescription | ||
33 | ) { | ||
34 | return get_curl_download_callback( | ||
35 | $charset, | ||
36 | $title, | ||
37 | $description, | ||
38 | $keywords, | ||
39 | $retrieveDescription | ||
40 | ); | ||
41 | } | ||
42 | |||
43 | public function getCurlHeaderCallback(&$charset, $curlGetInfo = 'curl_getinfo') | ||
44 | { | ||
45 | return get_curl_header_callback($charset, $curlGetInfo); | ||
46 | } | ||
47 | } | ||