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) |
||
69 | |||
70 | /** |
||
71 | * Checking if the option is set |
||
72 | * |
||
73 | * @param int $key One of the CURLOPT_* constant |
||
74 | * @return boolean |
||
75 | */ |
||
76 | public function hasOption($key) |
||
80 | |||
81 | /** |
||
82 | * Remove the option |
||
83 | * |
||
84 | * @param int $key One of the CURLOPT_* constant |
||
85 | */ |
||
86 | public function removeOption($key) |
||
92 | |||
93 | /** |
||
94 | * Calls curl_exec and returns its result |
||
95 | * |
||
96 | * @param array $options Array where key is a CURLOPT_* constant |
||
97 | * @return mixed Results of curl_exec |
||
98 | */ |
||
99 | public function exec($options = []) |
||
109 | } |