public function getResponse(array $query = array())
    {
        $headers = $this->headers;
        $json = null;
        
        if ($this->json) {
            $json   = json_encode($query);
            $query  = array();
        }
        
        //get the authorization parameters as an array
        $signature = $this->getSignature($query);
        $authorization  = $this->getAuthorization($signature, false);
        
        //if we should use the authrization
        if ($this->useAuthorization) {
            //add the string to headers
            $headers[] = sprintf(self::AUTH_HEADER, $this->buildQuery($authorization, ',', false));
        } else {
            //merge authorization and query
            $query = array_merge($authorization, $query);
        }
        
        $query = $this->buildQuery($query);
        $url = $this->url;
        
        //set curl
        $curl = Curl::i()->verifyHost(false)->verifyPeer(false);
        
        //if post
        if ($this->method == self::POST) {
            $headers[] = self::POST_HEADER;
            
            if (!is_null($json)) {
                $query = $json;
            }
            
            //get the response
            $response = $curl->setUrl($url)
                ->setPost(true)
                ->setPostFields($query)
                ->setHeaders($headers)
                ->getResponse();
        } else {
            if (trim($query)) {
                //determine the conector
                $connector = null;
                
                //if there is no question mark
                if (strpos($url, '?') === false) {
                    $connector = '?';
                //if the redirect doesn't end with a question mark
                } else if (substr($url, -1) != '?') {
                    $connector = '&';
                }
                
                //now add the secret to the redirect
                $url .= $connector.$query;
            }
            
            //get the response
            $response = $curl->setUrl($url)->setHeaders($headers)->getResponse();
        }
        
        $this->meta = $curl->getMeta();
        $this->meta['url'] = $url;
        $this->meta['authorization'] = $authorization;
        $this->meta['headers'] = $headers;
        $this->meta['query'] = $query;
        $this->meta['response'] = $response;
        
        return $response;
    }
public function getResponse(array $query = array())
    {
        $headers = $this->headers;
        $json = null;
        
        if ($this->json) {
            $json   = json_encode($query);
            $query  = array();
        }
        
        //get the authorization parameters as an array
        $signature = $this->getSignature($query);
        $authorization  = $this->getAuthorization($signature, false);
        
        //if we should use the authrization
        if ($this->useAuthorization) {
            //add the string to headers
            $headers[] = sprintf(self::AUTH_HEADER, $this->buildQuery($authorization, ',', false));
        } else {
            //merge authorization and query
            $query = array_merge($authorization, $query);
        }
        
        $query = $this->buildQuery($query);
        $url = $this->url;
        
        //set curl
        $curl = Curl::i()->verifyHost(false)->verifyPeer(false);
        
        //if post
        if ($this->method == self::POST) {
            $headers[] = self::POST_HEADER;
            
            if (!is_null($json)) {
                $query = $json;
            }
            
            //get the response
            $response = $curl->setUrl($url)
                ->setPost(true)
                ->setPostFields($query)
                ->setHeaders($headers)
                ->getResponse();
        } else {
            if (trim($query)) {
                //determine the conector
                $connector = null;
                
                //if there is no question mark
                if (strpos($url, '?') === false) {
                    $connector = '?';
                //if the redirect doesn't end with a question mark
                } else if (substr($url, -1) != '?') {
                    $connector = '&';
                }
                
                //now add the secret to the redirect
                $url .= $connector.$query;
            }
            
            //get the response
            $response = $curl->setUrl($url)->setHeaders($headers)->getResponse();
        }
        
        $this->meta = $curl->getMeta();
        $this->meta['url'] = $url;
        $this->meta['authorization'] = $authorization;
        $this->meta['headers'] = $headers;
        $this->meta['query'] = $query;
        $this->meta['response'] = $response;
        
        return $response;
    }
public function getResponse ( array $ query = array ( ) ) { $ headers = $ this -> headers ; $ json = null ; if ( $ this -> json ) { $ json = json_encode ( $ query ) ; $ query = array ( ) ; } //get the authorization parameters as an array $ signature = $ this -> getSignature ( $ query ) ; $ authorization = $ this -> getAuthorization ( $ signature , false ) ; //if we should use the authrization if ( $ this -> useAuthorization ) { //add the string to headers $ headers [ ] = sprintf ( self :: AUTH_HEADER , $ this -> buildQuery ( $ authorization , ',' , false ) ) ; } else { //merge authorization and query $ query = array_merge ( $ authorization , $ query ) ; } $ query = $ this -> buildQuery ( $ query ) ; $ url = $ this -> url ; //set curl $ curl = Curl :: i ( ) -> verifyHost ( false ) -> verifyPeer ( false ) ; //if post if ( $ this -> method == self :: POST ) { $ headers [ ] = self :: POST_HEADER ; if ( ! is_null ( $ json ) ) { $ query = $ json ; } //get the response $ response = $ curl -> setUrl ( $ url ) -> setPost ( true ) -> setPostFields ( $ query ) -> setHeaders ( $ headers ) -> getResponse ( ) ; } else { if ( trim ( $ query ) ) { //determine the conector $ connector = null ; //if there is no question mark if ( strpos ( $ url , '?' ) === false ) { $ connector = '?' ; //if the redirect doesn't end with a question mark } else if ( substr ( $ url , - 1 ) != '?' ) { $ connector = '&' ; } //now add the secret to the redirect $ url .= $ connector . $ query ; } //get the response $ response = $ curl -> setUrl ( $ url ) -> setHeaders ( $ headers ) -> getResponse ( ) ; } $ this -> meta = $ curl -> getMeta ( ) ; $ this -> meta [ 'url' ] = $ url ; $ this -> meta [ 'authorization' ] = $ authorization ; $ this -> meta [ 'headers' ] = $ headers ; $ this -> meta [ 'query' ] = $ query ; $ this -> meta [ 'response' ] = $ response ; return $ response ; }
Returns the token from the server

@param array $query Extra URL parameters

@return array
Returns the token from the server