1 | <?php |
||
14 | class CurlAdapter implements HttpInterface |
||
15 | { |
||
16 | |||
17 | protected $http; |
||
18 | protected $options; |
||
19 | protected $loggedIn; |
||
20 | |||
21 | public $cookieJar; |
||
22 | public $cookiePath; |
||
23 | |||
24 | /** |
||
25 | * Contains the curl instance |
||
26 | * |
||
27 | * @var resource |
||
28 | */ |
||
29 | private $curl; |
||
30 | |||
31 | /** |
||
32 | * Initializes curl resource |
||
33 | * |
||
34 | * @access public |
||
35 | * @param string $url |
||
36 | */ |
||
37 | public function init($url) |
||
41 | |||
42 | /** |
||
43 | * Sets an option in the curl instance |
||
44 | * |
||
45 | * @access public |
||
46 | * @param string $option |
||
47 | * @param string $value |
||
48 | * @return $this |
||
49 | */ |
||
50 | public function setOption($option, $value) |
||
56 | |||
57 | /** |
||
58 | * Sets multiple options at the same time |
||
59 | * |
||
60 | * @access public |
||
61 | * @param array $options |
||
62 | * @return $this |
||
63 | */ |
||
64 | public function setOptions(array $options = []) |
||
70 | |||
71 | |||
72 | /** |
||
73 | * Check if the curl request ended up with errors |
||
74 | * |
||
75 | * @access public |
||
76 | * @return boolean |
||
77 | */ |
||
78 | public function hasErrors() |
||
82 | |||
83 | /** |
||
84 | * Get curl errors |
||
85 | * |
||
86 | * @access public |
||
87 | * @return string |
||
88 | */ |
||
89 | public function getErrors() |
||
93 | |||
94 | /** |
||
95 | * Get curl info key |
||
96 | * |
||
97 | * @access public |
||
98 | * @param string $key |
||
99 | * @return string |
||
100 | */ |
||
101 | public function getInfo($key) |
||
105 | |||
106 | /** |
||
107 | * Close the curl resource |
||
108 | * |
||
109 | * @access public |
||
110 | * @return void |
||
111 | */ |
||
112 | public function close() |
||
116 | |||
117 | |||
118 | /** |
||
119 | * Executes curl request |
||
120 | * |
||
121 | * @return array |
||
122 | */ |
||
123 | public function execute() |
||
127 | } |
||
128 |