1 | <?php |
||
18 | class Curl extends CApplicationComponent |
||
19 | { |
||
20 | public $result; |
||
21 | |||
22 | private $ch; |
||
23 | |||
24 | private $error; |
||
25 | |||
26 | public function __construct(array $options = array()) |
||
41 | |||
42 | public function init() |
||
46 | |||
47 | /** |
||
48 | * @param integer $timeOut |
||
49 | */ |
||
50 | public function setTimeOut($timeOut = 30) |
||
54 | |||
55 | /** |
||
56 | * @param string $proxy localhost:3128 |
||
57 | */ |
||
58 | public function setProxy($proxy) |
||
62 | |||
63 | /** |
||
64 | * @param integer $flag |
||
65 | */ |
||
66 | public function setFollowLocation($flag) |
||
70 | |||
71 | /** |
||
72 | * @param string $agent |
||
73 | */ |
||
74 | public function setUserAgent($agent) |
||
78 | |||
79 | /** |
||
80 | * GET request |
||
81 | * |
||
82 | * @param string $url |
||
83 | * @param array $getParams |
||
84 | * |
||
85 | * @return mixed |
||
86 | */ |
||
87 | public function get($url, $getParams = array()) |
||
97 | |||
98 | /** |
||
99 | * POST request |
||
100 | * |
||
101 | * @param string $url |
||
102 | * @param array $postParams |
||
103 | * |
||
104 | * @return mixed |
||
105 | */ |
||
106 | public function post($url, $postParams = array()) |
||
114 | |||
115 | private function exec() |
||
122 | |||
123 | /** |
||
124 | * @return string error |
||
125 | * |
||
126 | */ |
||
127 | public function getLastError() |
||
131 | |||
132 | public function __destruct() |
||
136 | } |