public function sendRequest($url, $params, $method)
    {
        if($method=='POST')
        {
            if (!empty($params['file']))
                $ch = $this->initiateUpload($url, $params);
            else
                $ch = $this->initiatePost($url, $params);
        }
        else if($method=='GET')
        {
            $ch = $this->initiateGet($url, $params);
        }
        else if($method=='DELETE')
        {
            $ch = $this->initiateDelete($url, $params);
        }
        else{
            throw new \Exception("Method ".$method." not supported!");
        }

        if (! $ret = curl_exec($ch))
        {
            trigger_error(curl_error($ch));
        }

        curl_close($ch);
        return $ret;
    }
public function sendRequest($url, $params, $method)
    {
        if($method=='POST')
        {
            if (!empty($params['file']))
                $ch = $this->initiateUpload($url, $params);
            else
                $ch = $this->initiatePost($url, $params);
        }
        else if($method=='GET')
        {
            $ch = $this->initiateGet($url, $params);
        }
        else if($method=='DELETE')
        {
            $ch = $this->initiateDelete($url, $params);
        }
        else{
            throw new \Exception("Method ".$method." not supported!");
        }

        if (! $ret = curl_exec($ch))
        {
            trigger_error(curl_error($ch));
        }

        curl_close($ch);
        return $ret;
    }
public function sendRequest ( $ url , $ params , $ method ) { if ( $ method == 'POST' ) { if ( ! empty ( $ params [ 'file' ] ) ) $ ch = $ this -> initiateUpload ( $ url , $ params ) ; else $ ch = $ this -> initiatePost ( $ url , $ params ) ; } else if ( $ method == 'GET' ) { $ ch = $ this -> initiateGet ( $ url , $ params ) ; } else if ( $ method == 'DELETE' ) { $ ch = $ this -> initiateDelete ( $ url , $ params ) ; } else { throw new \ Exception ( "Method " . $ method . " not supported!" ) ; } if ( ! $ ret = curl_exec ( $ ch ) ) { trigger_error ( curl_error ( $ ch ) ) ; } curl_close ( $ ch ) ; return $ ret ; }
Sends the request via curl

@param string $url       Relative url for the request
@param array $params     Parameters for the request
@param string $method    Request method
@return string
Sends the request via curl