Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.0.x will end 8 May 2023 (12 months).
  • Bug fixes for security issues in 4.0.x will end 13 November 2023 (18 months).
  • PHP version: minimum PHP 7.3.0 Note: the minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is also supported.

Differences Between: [Versions 400 and 401] [Versions 400 and 402] [Versions 400 and 403]

(no description)

File Size: 282 lines (9 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class


Class: OAuthRequest  - X-Ref

Class to represent an %OAuth Request

__construct($http_method, $http_url, $parameters = null)   X-Ref
No description

from_request($http_method = null, $http_url = null, $parameters = null)   X-Ref
attempt to build up a request from what was passed to the server


from_consumer_and_token($consumer, $token, $http_method, $http_url, $parameters = null)   X-Ref
pretty much a helper function to set up the request


set_parameter($name, $value, $allow_duplicates = true)   X-Ref
No description

get_parameter($name)   X-Ref
No description

get_parameters()   X-Ref
No description

unset_parameter($name)   X-Ref
No description

get_signable_parameters()   X-Ref
The request parameters, sorted and concatenated into a normalized string.

return: string

get_signature_base_string()   X-Ref
Returns the base string of this request

The base string defined as the method, the url
and the parameters (normalized), each urlencoded
and the concated with &.

get_normalized_http_method()   X-Ref
just uppercases the http method


get_normalized_http_url()   X-Ref
parses the url and rebuilds it to be
scheme://host/path


to_url()   X-Ref
builds a url usable for a GET request


to_postdata()   X-Ref
builds the data one would send in a POST request


to_header($realm = null)   X-Ref
builds the Authorization: header


__toString()   X-Ref
No description

sign_request($signature_method, $consumer, $token)   X-Ref
No description

build_signature($signature_method, $consumer, $token)   X-Ref
No description

generate_timestamp()   X-Ref
util function: current timestamp


generate_nonce()   X-Ref
util function: current nonce