| 1 | <?php |
||
| 9 | class CurlRequest implements RequestInterface |
||
| 10 | { |
||
| 11 | /** |
||
| 12 | * Curl handle |
||
| 13 | * @var resource |
||
| 14 | */ |
||
| 15 | private $handle; |
||
| 16 | |||
| 17 | /** |
||
| 18 | * Constructor |
||
| 19 | * Create curl handle |
||
| 20 | * @param $url |
||
| 21 | */ |
||
| 22 | 13 | public function __construct($url = null) |
|
| 26 | |||
| 27 | /** |
||
| 28 | * Close connection |
||
| 29 | */ |
||
| 30 | 3 | public function __destruct() |
|
| 34 | |||
| 35 | /** |
||
| 36 | * @param $url |
||
| 37 | * @return bool |
||
| 38 | */ |
||
| 39 | 3 | public function setUrl($url) |
|
| 43 | |||
| 44 | /** |
||
| 45 | * Set option |
||
| 46 | * @param string $name |
||
| 47 | * @param mixed $value |
||
| 48 | * @return $this |
||
| 49 | */ |
||
| 50 | 3 | public function setOption($name, $value) |
|
| 55 | |||
| 56 | /** |
||
| 57 | * Execute request |
||
| 58 | * @return mixed |
||
| 59 | */ |
||
| 60 | public function execute() |
||
| 64 | |||
| 65 | /** |
||
| 66 | * Get info from request |
||
| 67 | * @param int $opt |
||
| 68 | * @return mixed |
||
| 69 | */ |
||
| 70 | 2 | public function getInfo($opt = null) |
|
| 77 | |||
| 78 | /** |
||
| 79 | * Get error message |
||
| 80 | * @return mixed |
||
| 81 | */ |
||
| 82 | public function getError() |
||
| 86 | |||
| 87 | /** |
||
| 88 | * Close http connection |
||
| 89 | * @return void |
||
| 90 | */ |
||
| 91 | 3 | public function close() |
|
| 95 | } |
||
| 96 |