1 | <?php |
||
5 | class Curl |
||
6 | { |
||
7 | /** |
||
8 | * @var resource |
||
9 | */ |
||
10 | protected $curl; |
||
11 | |||
12 | /** |
||
13 | * @var array |
||
14 | */ |
||
15 | protected $options; |
||
16 | |||
17 | /** |
||
18 | * @param array $options Array of the Curl options, where key is a CURLOPT_* constant |
||
19 | */ |
||
20 | public function __construct($options = []) |
||
25 | |||
26 | public function __destruct() |
||
32 | |||
33 | /** |
||
34 | * Set the Curl options. |
||
35 | * |
||
36 | * @param array $options Array of the Curl options, where key is a CURLOPT_* constant |
||
37 | */ |
||
38 | public function setOptions($options) |
||
44 | |||
45 | /** |
||
46 | * Set the Curl option. |
||
47 | * |
||
48 | * @param int $key One of the CURLOPT_* constant |
||
49 | * @param mixed $value The value of the CURL option |
||
50 | */ |
||
51 | public function setOption($key, $value) |
||
55 | |||
56 | /** |
||
57 | * Returns the value of the option. |
||
58 | * |
||
59 | * @param int $key One of the CURLOPT_* constant |
||
60 | * @return mixed|null The value of the option set, or NULL, if it does not exist |
||
61 | */ |
||
62 | public function getOption($key) |
||
70 | |||
71 | /** |
||
72 | * Checking if the option is set. |
||
73 | * |
||
74 | * @param int $key One of the CURLOPT_* constant |
||
75 | * @return bool |
||
76 | */ |
||
77 | public function hasOption($key) |
||
81 | |||
82 | /** |
||
83 | * Remove the option. |
||
84 | * |
||
85 | * @param int $key One of the CURLOPT_* constant |
||
86 | */ |
||
87 | public function removeOption($key) |
||
93 | |||
94 | /** |
||
95 | * Calls curl_exec and returns its result. |
||
96 | * |
||
97 | * @param array $options Array where key is a CURLOPT_* constant |
||
98 | * @return mixed Results of curl_exec |
||
99 | */ |
||
100 | public function exec($options = []) |
||
110 | } |
||
111 |