_apiUrl = $url; } public function setConnection($curl) { $this->_curlObj = $curl; } public function setUserId ($userId) { $this->_userId = $userId; } public function setPassword ($password) { $this->_password = $password; } public function getPrivateTree () { $this->_curlObj->create($this->_apiUrl. 'space/dir/isgetall/1'); $this->_curlObj->option(CURLOPT_BUFFERSIZE, 10); $this->_curlObj->options(array(CURLOPT_BUFFERSIZE => 10)); $post = $this->_userId ? array('userid' => $this->_userId) : array(); $this->_curlObj->post($post); return $this->_curlObj->execute(); } /** * $aryParams * * @param unknown $action * @param unknown $aryParams */ public function actionExecute ($action, $aryParams = array(), $module = 'space') { $this->_curlObj->create($this->_apiUrl. $module .'/'.$action); $this->_curlObj->option(CURLOPT_BUFFERSIZE, 10); $this->_curlObj->options(array(CURLOPT_BUFFERSIZE => 10)); if ($this->_httpUser && $this->_httpPasswd) { $this->_curlObj->http_login($this->_httpUser, $this->_httpPasswd); } if ($this->_userId) $aryParams['userid'] = $this->_userId; if (count($aryParams) > 0) $this->_curlObj->post($aryParams); $result = $this->_curlObj->execute(); write_file('log.txt', var_export($result, true)."\n".var_export($this->_apiUrl. $module .'/'.$action, true)."\n".var_export($aryParams, true)); return $result; } public function __destruct() { } }