Dailymotion.php
protected function oauthRequest($url, $payload, $accessToken = null, $headers = array(), &$statusCode = null, &$responseHeaders = array())
    {
        if ($accessToken !== null)
        {
            $headers[] = "Authorization: Bearer {$accessToken}";
        }
        $result = $this->httpRequest(
            $url,
            $payload,
            $headers,
            $statusCode,
            $responseHeaders
        );
        switch ($statusCode)
        {
            case 401: // Invalid or expired token
            case 400: // Invalid request
            case 403: // Insufficient scope
                $error   = null;
                $message = null;
                $match   = array();

                if (preg_match('/error="(.*?)"(?:, error_description="(.*?)")?/', $responseHeaders['www-authenticate'], $match))
                {
                    $error   = $match[1];
                    $message = $match[2];
                }
                $e = new DailymotionAuthException($message);
                $e->error = $error;
                throw $e;
        }
        return $result;
    }
protected function oauthRequest($url, $payload, $accessToken = null, $headers = array(), &$statusCode = null, &$responseHeaders = array())
    {
        if ($accessToken !== null)
        {
            $headers[] = "Authorization: Bearer {$accessToken}";
        }
        $result = $this->httpRequest(
            $url,
            $payload,
            $headers,
            $statusCode,
            $responseHeaders
        );
        switch ($statusCode)
        {
            case 401: // Invalid or expired token
            case 400: // Invalid request
            case 403: // Insufficient scope
                $error   = null;
                $message = null;
                $match   = array();

                if (preg_match('/error="(.*?)"(?:, error_description="(.*?)")?/', $responseHeaders['www-authenticate'], $match))
                {
                    $error   = $match[1];
                    $message = $match[2];
                }
                $e = new DailymotionAuthException($message);
                $e->error = $error;
                throw $e;
        }
        return $result;
    }
protected function oauthRequest ( $ url , $ payload , $ accessToken = null , $ headers = array ( ) , & $ statusCode = null , & $ responseHeaders = array ( ) ) { if ( $ accessToken !== null ) { $ headers [ ] = "Authorization: Bearer {$accessToken}" ; } $ result = $ this -> httpRequest ( $ url , $ payload , $ headers , $ statusCode , $ responseHeaders ) ; switch ( $ statusCode ) { case 401 : // Invalid or expired token case 400 : // Invalid request case 403 : // Insufficient scope $ error = null ; $ message = null ; $ match = array ( ) ; if ( preg_match ( '/error="(.*?)"(?:, error_description="(.*?)")?/' , $ responseHeaders [ 'www-authenticate' ] , $ match ) ) { $ error = $ match [ 1 ] ; $ message = $ match [ 2 ] ; } $ e = new DailymotionAuthException ( $ message ) ; $ e -> error = $ error ; throw $ e ; } return $ result ; }
Perform an OAuth 2.0 authenticated request.

@param string $url the         URL to perform the HTTP request to.
@param string $payload         Encoded method request to POST.
@param string $accessToken     OAuth access token to authenticate the request with.
@param array  $headers         List of headers to send with the request (format `array('Header-Name: header value')`).
@param int   &$statusCode      Reference variable to store the response status code.
@param array &$responseHeaders Reference variable to store the response headers.

@throws DailymotionAuthException      If an OAuth error occurs.
@throws DailymotionTransportException If a network error occurs during the request.

@return string Response body.
Perform an OAuth 2 . 0 authenticated request .