public function signature($method, $path, array $params = array())
    {
        $params = $this->completeParams($params);

        ksort($params);

        if (isset($params['file'])) {
            unset($params['file']);
        }

        $canonicalQueryString = str_replace(
            array('+', '%5B', '%5D'),
            array('%20', '[', ']'),
            http_build_query($params, '', '&')
        );
        $stringToSign = sprintf(
            "%s\n%s\n%s\n%s",
            strtoupper($method),
            $this->account->getApiHost(),
            $path,
            $canonicalQueryString
        );
        $hmac = hash_hmac('sha256', $stringToSign, $this->account->getSecretKey(), true);

        return base64_encode($hmac);
    }
public function signature($method, $path, array $params = array())
    {
        $params = $this->completeParams($params);

        ksort($params);

        if (isset($params['file'])) {
            unset($params['file']);
        }

        $canonicalQueryString = str_replace(
            array('+', '%5B', '%5D'),
            array('%20', '[', ']'),
            http_build_query($params, '', '&')
        );
        $stringToSign = sprintf(
            "%s\n%s\n%s\n%s",
            strtoupper($method),
            $this->account->getApiHost(),
            $path,
            $canonicalQueryString
        );
        $hmac = hash_hmac('sha256', $stringToSign, $this->account->getSecretKey(), true);

        return base64_encode($hmac);
    }
public function signature ( $ method , $ path , array $ params = array ( ) ) { $ params = $ this -> completeParams ( $ params ) ; ksort ( $ params ) ; if ( isset ( $ params [ 'file' ] ) ) { unset ( $ params [ 'file' ] ) ; } $ canonicalQueryString = str_replace ( array ( '+' , '%5B' , '%5D' ) , array ( '%20' , '[' , ']' ) , http_build_query ( $ params , '' , '&' ) ) ; $ stringToSign = sprintf ( "%s\n%s\n%s\n%s" , strtoupper ( $ method ) , $ this -> account -> getApiHost ( ) , $ path , $ canonicalQueryString ) ; $ hmac = hash_hmac ( 'sha256' , $ stringToSign , $ this -> account -> getSecretKey ( ) , true ) ; return base64_encode ( $ hmac ) ; }
Generates the signature for an API requests based on its parameters.

@param string   $method The HTTP method
@param string   $path   The request path
@param string[] $params Request parameters

@return string The generated signature
Generates the signature for an API requests based on its parameters .