source: pro-violet-viettel/sourcecode/application/libraries/vservices.php @ 382

Last change on this file since 382 was 365, checked in by dungnv, 11 years ago
File size: 1.3 KB
Line 
1<?php
2
3Class VServices {
4       
5        private $_apiUrl;
6        private $_curlObj;
7        private $_userId;
8        private $_password;
9       
10        public function __construct() {
11               
12        }
13       
14        public function setApiUrl($url) {
15                $this->_apiUrl = $url;
16        }
17       
18        public function setConnection($curl) {
19                $this->_curlObj = $curl;
20        }
21       
22        public function setUserId ($userId) {
23                $this->_userId = $userId;
24        }
25       
26        public function setPassword ($password) {
27                $this->_password = $password;
28        }
29       
30        public function getPrivateTree () {
31                $this->_curlObj->create($this->_apiUrl. 'space/dir/isgetall/1');
32                $this->_curlObj->option(CURLOPT_BUFFERSIZE, 10);
33                $this->_curlObj->options(array(CURLOPT_BUFFERSIZE => 10));
34                $post =  $this->_userId ? array('userid' => $this->_userId) : array();
35                $this->_curlObj->post($post);
36                return $this->_curlObj->execute();
37        }
38       
39        /**
40         * $aryParams
41         *
42         * @param unknown $action
43         * @param unknown $aryParams
44         */
45        public function actionExecute ($action, $aryParams = array()) {
46                $this->_curlObj->create($this->_apiUrl. 'space/'.$action);
47                $this->_curlObj->option(CURLOPT_BUFFERSIZE, 10);
48                $this->_curlObj->options(array(CURLOPT_BUFFERSIZE => 10));
49               
50                if ($this->_userId) $aryParams['userid'] = $this->_userId;
51                $this->_curlObj->post($aryParams);
52                return $this->_curlObj->execute();
53        }       
54                       
55        public function __destruct() {
56               
57        }
58}
Note: See TracBrowser for help on using the repository browser.