restUrl = 'http://' . $_SERVER["HTTP_HOST"] . Config::get('web_prefix') . '/social/rest'; } protected function curlRest($url, $postData, $contentType, $method = 'POST') { $ch = curl_init(); if (substr($url, 0, 1) != '/') { $url = '/' . $url; } $sep = strpos($url, '?') !== false ? '&' : '?'; curl_setopt($ch, CURLOPT_URL, $this->restUrl . $url . $sep . 'st=' . $this->securityToken); curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: $contentType")); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $method); curl_setopt($ch, CURLOPT_POSTFIELDS, $postData); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $ret = curl_exec($ch); curl_close($ch); return $ret; } protected function getSecurityToken() { return $this->securityToken; } protected function setSecurityToken($token) { $this->securityToken = $token; } protected function getRestUrl() { return $this->restUrl; } protected function setRestUrl($url) { $this->restUrl = $url; } }