private function generateMACSignature($url, $parameters, $http_method)
    {
        $timestamp = time();
        $nonce = uniqid();
        $parsed_url = parse_url($url);
        if (!isset($parsed_url['port']))
        {
            $parsed_url['port'] = ($parsed_url['scheme'] == 'https') ? 443 : 80;
        }
        if ($http_method == self::HTTP_METHOD_GET) {
            if (is_array($parameters)) {
                $parsed_url['path'] .= '?' . http_build_query($parameters, null, '&');
            } elseif ($parameters) {
                $parsed_url['path'] .= '?' . $parameters;
            }
        }

        $signature = base64_encode(hash_hmac($this->access_token_algorithm,
                    $timestamp . "\n"
                    . $nonce . "\n"
                    . $http_method . "\n"
                    . $parsed_url['path'] . "\n"
                    . $parsed_url['host'] . "\n"
                    . $parsed_url['port'] . "\n\n"
                    , $this->access_token_secret, true));

        return 'id="' . $this->access_token . '", ts="' . $timestamp . '", nonce="' . $nonce . '", mac="' . $signature . '"';
    }
private function generateMACSignature($url, $parameters, $http_method)
    {
        $timestamp = time();
        $nonce = uniqid();
        $parsed_url = parse_url($url);
        if (!isset($parsed_url['port']))
        {
            $parsed_url['port'] = ($parsed_url['scheme'] == 'https') ? 443 : 80;
        }
        if ($http_method == self::HTTP_METHOD_GET) {
            if (is_array($parameters)) {
                $parsed_url['path'] .= '?' . http_build_query($parameters, null, '&');
            } elseif ($parameters) {
                $parsed_url['path'] .= '?' . $parameters;
            }
        }

        $signature = base64_encode(hash_hmac($this->access_token_algorithm,
                    $timestamp . "\n"
                    . $nonce . "\n"
                    . $http_method . "\n"
                    . $parsed_url['path'] . "\n"
                    . $parsed_url['host'] . "\n"
                    . $parsed_url['port'] . "\n\n"
                    , $this->access_token_secret, true));

        return 'id="' . $this->access_token . '", ts="' . $timestamp . '", nonce="' . $nonce . '", mac="' . $signature . '"';
    }
private function generateMACSignature ( $ url , $ parameters , $ http_method ) { $ timestamp = time ( ) ; $ nonce = uniqid ( ) ; $ parsed_url = parse_url ( $ url ) ; if ( ! isset ( $ parsed_url [ 'port' ] ) ) { $ parsed_url [ 'port' ] = ( $ parsed_url [ 'scheme' ] == 'https' ) ? 443 : 80 ; } if ( $ http_method == self :: HTTP_METHOD_GET ) { if ( is_array ( $ parameters ) ) { $ parsed_url [ 'path' ] .= '?' . http_build_query ( $ parameters , null , '&' ) ; } elseif ( $ parameters ) { $ parsed_url [ 'path' ] .= '?' . $ parameters ; } } $ signature = base64_encode ( hash_hmac ( $ this -> access_token_algorithm , $ timestamp . "\n" . $ nonce . "\n" . $ http_method . "\n" . $ parsed_url [ 'path' ] . "\n" . $ parsed_url [ 'host' ] . "\n" . $ parsed_url [ 'port' ] . "\n\n" , $ this -> access_token_secret , true ) ) ; return 'id="' . $ this -> access_token . '", ts="' . $ timestamp . '", nonce="' . $ nonce . '", mac="' . $ signature . '"' ; }
Generate the MAC signature

@param string $url Called URL
@param array  $parameters Parameters
@param string $http_method Http Method
@return string
Generate the MAC signature