private function getAuthorization($url, $method, &$params, $flags) {
        $oauth = array(
            'oauth_consumer_key'     => $this->ck,
            'oauth_signature_method' => 'HMAC-SHA1',
            'oauth_timestamp'        => time(),
            'oauth_version'          => '1.0a',
            'oauth_nonce'            => md5(mt_rand()),
            'oauth_token'            => $this->ot,
        );
        $key = array($this->cs, $this->os);
        if ($flags & self::MODE_REQUEST_TOKEN) {
            $key[1] = '';
            if (isset($params['oauth_callback'])) {
                $oauth['oauth_callback'] = $params['oauth_callback'];
            }
            unset($oauth['oauth_token'], $params['oauth_callback']);
        }
        if ($flags & self::MODE_ACCESS_TOKEN) {
            $oauth['oauth_verifier'] = $params['oauth_verifier'];
            unset($params['oauth_verifier']);
        }
        $base = $oauth + $params;
        uksort($base, 'strnatcmp');
        $oauth['oauth_signature'] = base64_encode(hash_hmac(
            'sha1',
            implode('&', array_map('rawurlencode', array(
                $method,
                $url,
                str_replace(
                    array('+', '%7E'),
                    array('%20', '~'),
                    http_build_query($base, '', '&')
                ),
            ))),
            implode('&', array_map('rawurlencode', $key)),
            true
        ));
        $tmp = array();
        foreach ($oauth as $key => $value) {
            $tmp[] = urlencode($key) . '="' . urlencode($value) . '"';
        }
        return array(
            'Authorization: OAuth ' . implode(', ', $tmp)
        );
    }
private function getAuthorization($url, $method, &$params, $flags) {
        $oauth = array(
            'oauth_consumer_key'     => $this->ck,
            'oauth_signature_method' => 'HMAC-SHA1',
            'oauth_timestamp'        => time(),
            'oauth_version'          => '1.0a',
            'oauth_nonce'            => md5(mt_rand()),
            'oauth_token'            => $this->ot,
        );
        $key = array($this->cs, $this->os);
        if ($flags & self::MODE_REQUEST_TOKEN) {
            $key[1] = '';
            if (isset($params['oauth_callback'])) {
                $oauth['oauth_callback'] = $params['oauth_callback'];
            }
            unset($oauth['oauth_token'], $params['oauth_callback']);
        }
        if ($flags & self::MODE_ACCESS_TOKEN) {
            $oauth['oauth_verifier'] = $params['oauth_verifier'];
            unset($params['oauth_verifier']);
        }
        $base = $oauth + $params;
        uksort($base, 'strnatcmp');
        $oauth['oauth_signature'] = base64_encode(hash_hmac(
            'sha1',
            implode('&', array_map('rawurlencode', array(
                $method,
                $url,
                str_replace(
                    array('+', '%7E'),
                    array('%20', '~'),
                    http_build_query($base, '', '&')
                ),
            ))),
            implode('&', array_map('rawurlencode', $key)),
            true
        ));
        $tmp = array();
        foreach ($oauth as $key => $value) {
            $tmp[] = urlencode($key) . '="' . urlencode($value) . '"';
        }
        return array(
            'Authorization: OAuth ' . implode(', ', $tmp)
        );
    }
private function getAuthorization ( $ url , $ method , & $ params , $ flags ) { $ oauth = array ( 'oauth_consumer_key' => $ this -> ck , 'oauth_signature_method' => 'HMAC-SHA1' , 'oauth_timestamp' => time ( ) , 'oauth_version' => '1.0a' , 'oauth_nonce' => md5 ( mt_rand ( ) ) , 'oauth_token' => $ this -> ot , ) ; $ key = array ( $ this -> cs , $ this -> os ) ; if ( $ flags & self :: MODE_REQUEST_TOKEN ) { $ key [ 1 ] = '' ; if ( isset ( $ params [ 'oauth_callback' ] ) ) { $ oauth [ 'oauth_callback' ] = $ params [ 'oauth_callback' ] ; } unset ( $ oauth [ 'oauth_token' ] , $ params [ 'oauth_callback' ] ) ; } if ( $ flags & self :: MODE_ACCESS_TOKEN ) { $ oauth [ 'oauth_verifier' ] = $ params [ 'oauth_verifier' ] ; unset ( $ params [ 'oauth_verifier' ] ) ; } $ base = $ oauth + $ params ; uksort ( $ base , 'strnatcmp' ) ; $ oauth [ 'oauth_signature' ] = base64_encode ( hash_hmac ( 'sha1' , implode ( '&' , array_map ( 'rawurlencode' , array ( $ method , $ url , str_replace ( array ( '+' , '%7E' ) , array ( '%20' , '~' ) , http_build_query ( $ base , '' , '&' ) ) , ) ) ) , implode ( '&' , array_map ( 'rawurlencode' , $ key ) ) , true ) ) ; $ tmp = array ( ) ; foreach ( $ oauth as $ key => $ value ) { $ tmp [ ] = urlencode ( $ key ) . '="' . urlencode ( $ value ) . '"' ; } return array ( 'Authorization: OAuth ' . implode ( ', ' , $ tmp ) ) ; }
Prepare headers for authorization.

@param string $url endpoint URL
@param string $method GET or POST
@param array &$params 1-demensional array
@param int $flags self::MODE_*
@return array headers
Prepare headers for authorization .