aboutsummaryrefslogtreecommitdiffhomepage
path: root/application/http/HttpAccess.php
blob: 646a526404c550fd6fdaacab6ac298c86ec6a585 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
<?php

declare(strict_types=1);

namespace Shaarli\Http;

/**
 * Class HttpAccess
 *
 * This is mostly an OOP wrapper for HTTP functions defined in `HttpUtils`.
 * It is used as dependency injection in Shaarli's container.
 *
 * @package Shaarli\Http
 */
class HttpAccess
{
    public function getHttpResponse(
        $url,
        $timeout = 30,
        $maxBytes = 4194304,
        $curlHeaderFunction = null,
        $curlWriteFunction = null
    ) {
        return get_http_response($url, $timeout, $maxBytes, $curlHeaderFunction, $curlWriteFunction);
    }

    public function getCurlDownloadCallback(
        &$charset,
        &$title,
        &$description,
        &$keywords,
        $retrieveDescription
    ) {
        return get_curl_download_callback(
            $charset,
            $title,
            $description,
            $keywords,
            $retrieveDescription
        );
    }

    public function getCurlHeaderCallback(&$charset, $curlGetInfo = 'curl_getinfo')
    {
        return get_curl_header_callback($charset, $curlGetInfo);
    }
}