private function generateMac($url, $query, $secret)
    {
        // break URL into parts to get the path
        $urlParts = parse_url($url);

        // trim double slashes in the path
        if (substr($urlParts['path'], 0, 2) == '//') {
            $urlParts['path'] = substr($urlParts['path'], 1);
        }

        // build query string from given parameters
        $queryString = urldecode(http_build_query($query));

        // combine strings to build the signing string
        $signingString = $query['api_id'] . "\n" .
            $query['api_ts'] . "\n" .
            $urlParts['path'] . "\n" .
            $queryString;

        $mac = hash_hmac('sha1', $signingString, $secret);


        return $mac;
    }
private function generateMac($url, $query, $secret)
    {
        // break URL into parts to get the path
        $urlParts = parse_url($url);

        // trim double slashes in the path
        if (substr($urlParts['path'], 0, 2) == '//') {
            $urlParts['path'] = substr($urlParts['path'], 1);
        }

        // build query string from given parameters
        $queryString = urldecode(http_build_query($query));

        // combine strings to build the signing string
        $signingString = $query['api_id'] . "\n" .
            $query['api_ts'] . "\n" .
            $urlParts['path'] . "\n" .
            $queryString;

        $mac = hash_hmac('sha1', $signingString, $secret);


        return $mac;
    }
private function generateMac ( $ url , $ query , $ secret ) { // break URL into parts to get the path $ urlParts = parse_url ( $ url ) ; // trim double slashes in the path if ( substr ( $ urlParts [ 'path' ] , 0 , 2 ) == '//' ) { $ urlParts [ 'path' ] = substr ( $ urlParts [ 'path' ] , 1 ) ; } // build query string from given parameters $ queryString = urldecode ( http_build_query ( $ query ) ) ; // combine strings to build the signing string $ signingString = $ query [ 'api_id' ] . "\n" . $ query [ 'api_ts' ] . "\n" . $ urlParts [ 'path' ] . "\n" . $ queryString ; $ mac = hash_hmac ( 'sha1' , $ signingString , $ secret ) ; return $ mac ; }
Creates a hash based on request parameters

@param string $url
@param array $query
@param string $secret
@return string
Creates a hash based on request parameters