1 | <?php
|
---|
2 |
|
---|
3 | Class VServices {
|
---|
4 |
|
---|
5 | private $_apiUrl;
|
---|
6 | private $_curlObj;
|
---|
7 | private $_userId;
|
---|
8 | private $_password;
|
---|
9 |
|
---|
10 | public function __construct() {
|
---|
11 | }
|
---|
12 | public function setApiUrl($url) {
|
---|
13 | $this->_apiUrl = $url;
|
---|
14 | }
|
---|
15 |
|
---|
16 | public function setConnection($curl) {
|
---|
17 | $this->_curlObj = $curl;
|
---|
18 | }
|
---|
19 |
|
---|
20 | public function setUserId ($userId) {
|
---|
21 | $this->_userId = $userId;
|
---|
22 | }
|
---|
23 |
|
---|
24 | public function setPassword ($password) {
|
---|
25 | $this->_password = $password;
|
---|
26 | }
|
---|
27 |
|
---|
28 | public function getPrivateTree () {
|
---|
29 | $this->_curlObj->create($this->_apiUrl. 'space/dir/isgetall/1');
|
---|
30 | $this->_curlObj->option(CURLOPT_BUFFERSIZE, 10);
|
---|
31 | $this->_curlObj->options(array(CURLOPT_BUFFERSIZE => 10));
|
---|
32 | $post = $this->_userId ? array('userid' => $this->_userId) : array();
|
---|
33 | $this->_curlObj->post($post);
|
---|
34 | return $this->_curlObj->execute();
|
---|
35 | }
|
---|
36 |
|
---|
37 | /**
|
---|
38 | * $aryParams
|
---|
39 | *
|
---|
40 | * @param unknown $action
|
---|
41 | * @param unknown $aryParams
|
---|
42 | */
|
---|
43 | public function actionExecute ($action, $aryParams = array(), $module = 'space') {
|
---|
44 | $this->_curlObj->create($this->_apiUrl. $module.'/'.$action);
|
---|
45 | $this->_curlObj->option(CURLOPT_BUFFERSIZE, 10);
|
---|
46 | $this->_curlObj->options(array(CURLOPT_BUFFERSIZE => 10));
|
---|
47 |
|
---|
48 | if ($this->_userId) $aryParams['userid'] = $this->_userId;
|
---|
49 | $this->_curlObj->post($aryParams);
|
---|
50 | return $this->_curlObj->execute();
|
---|
51 | }
|
---|
52 |
|
---|
53 | public function __destruct() {
|
---|
54 |
|
---|
55 | }
|
---|
56 | } |
---|