Dailymotion.php
protected function oauthTokenRequest(array $args)
    {
        $statusCode = null;
        $responseHeaders = array();
        $result = json_decode(
            $response = $this->httpRequest(
                $this->oauthTokenEndpointUrl,
                $args,
                null,
                $statusCode,
                $responseHeaders,
                true
            ),
            true
        );
        if (empty($result))
        {
            throw new DailymotionAuthException("Invalid token server response: {$response}");
        }
        elseif (isset($result['error']))
        {
            $message = isset($result['error_description']) ? $result['error_description'] : null;
            $e = new DailymotionAuthException($message);
            $e->error = $result['error'];
            throw $e;
        }
        elseif (isset($result['access_token']))
        {
            return array(
                'access_token'  => $result['access_token'],
                'expires'       => time() + $result['expires_in'],
                'refresh_token' => isset($result['refresh_token']) ? $result['refresh_token'] : null,
                'scope'         => isset($result['scope']) ? explode(chr(32), $result['scope']) : array(),
            );
        }
        else
        {
            throw new DailymotionAuthException('No access token found in the token server response');
        }
    }
protected function oauthTokenRequest(array $args)
    {
        $statusCode = null;
        $responseHeaders = array();
        $result = json_decode(
            $response = $this->httpRequest(
                $this->oauthTokenEndpointUrl,
                $args,
                null,
                $statusCode,
                $responseHeaders,
                true
            ),
            true
        );
        if (empty($result))
        {
            throw new DailymotionAuthException("Invalid token server response: {$response}");
        }
        elseif (isset($result['error']))
        {
            $message = isset($result['error_description']) ? $result['error_description'] : null;
            $e = new DailymotionAuthException($message);
            $e->error = $result['error'];
            throw $e;
        }
        elseif (isset($result['access_token']))
        {
            return array(
                'access_token'  => $result['access_token'],
                'expires'       => time() + $result['expires_in'],
                'refresh_token' => isset($result['refresh_token']) ? $result['refresh_token'] : null,
                'scope'         => isset($result['scope']) ? explode(chr(32), $result['scope']) : array(),
            );
        }
        else
        {
            throw new DailymotionAuthException('No access token found in the token server response');
        }
    }
protected function oauthTokenRequest ( array $ args ) { $ statusCode = null ; $ responseHeaders = array ( ) ; $ result = json_decode ( $ response = $ this -> httpRequest ( $ this -> oauthTokenEndpointUrl , $ args , null , $ statusCode , $ responseHeaders , true ) , true ) ; if ( empty ( $ result ) ) { throw new DailymotionAuthException ( "Invalid token server response: {$response}" ) ; } elseif ( isset ( $ result [ 'error' ] ) ) { $ message = isset ( $ result [ 'error_description' ] ) ? $ result [ 'error_description' ] : null ; $ e = new DailymotionAuthException ( $ message ) ; $ e -> error = $ result [ 'error' ] ; throw $ e ; } elseif ( isset ( $ result [ 'access_token' ] ) ) { return array ( 'access_token' => $ result [ 'access_token' ] , 'expires' => time ( ) + $ result [ 'expires_in' ] , 'refresh_token' => isset ( $ result [ 'refresh_token' ] ) ? $ result [ 'refresh_token' ] : null , 'scope' => isset ( $ result [ 'scope' ] ) ? explode ( chr ( 32 ) , $ result [ 'scope' ] ) : array ( ) , ) ; } else { throw new DailymotionAuthException ( 'No access token found in the token server response' ) ; } }
Perform a request to a token server complient with the OAuth 2.0 specification.

@param array $args Arguments to send to the token server.
@throws DailymotionAuthException If the token server sends an error or invalid response.
@return array Cconfigured session.
Perform a request to a token server complient with the OAuth 2 . 0 specification .