Moodle PHP Documentation 4.2
Moodle 4.2.8 (Build: 20240610) (2d41ac46f45)
Google_Http_Request Class Reference

Public Member Functions

 __construct ( $url, $method='GET', $headers=array(), $postBody=null)
 
 canGzip ()
 Can this request accept a gzip response?
 
 disableExpectedRaw ()
 Disable expected raw response.
 
 disableGzip ()
 Disable support for gzip responses with this request.
 
 enableExpectedRaw ()
 Enable expected raw response.
 
 enableGzip ()
 Enable support for gzipped responses with this request.
 
 getBaseComponent ()
 Misc function that returns the base url component of the $url used by the OAuth signing class to calculate the base string.
 
 getCacheKey ()
 Returns a cache key depending on if this was an OAuth signed request in which case it will use the non-signed url and access key to make this cache key unique per authenticated user, else use the plain request url.
 
 getExpectedClass ()
 Retrieve the expected class the response should expect.
 
 getExpectedRaw ()
 Expected raw response or not.
 
 getParsedCacheControl ()
 
 getPostBody ()
 
 getQueryParams ()
 Misc function that returns an array of the query parameters of the current url used by the OAuth signing class to calculate the signature.
 
 getRequestHeader ($key)
 
 getRequestHeaders ()
 
 getRequestMethod ()
 
 getResponseBody ()
 
 getResponseHeader ($key)
 
 getResponseHeaders ()
 
 getResponseHttpCode ()
 
 getUrl ()
 
 getUserAgent ()
 
 maybeMoveParametersToBody ()
 If we're POSTing and have no body to send, we can send the query parameters in there, which avoids length issues with longer query params.
 
 setBaseComponent ($baseComponent)
 Set the base URL that path and query parameters will be added to.
 
 setExpectedClass ($class)
 Set the class the response to this request should expect.
 
 setPostBody ($postBody)
 
 setQueryParam ($key, $value)
 Set a new query parameter.
 
 setRequestHeaders ($headers)
 
 setRequestMethod ($method)
 
 setResponseBody ($responseBody)
 
 setResponseHeaders ($headers)
 
 setResponseHttpCode ($responseHttpCode)
 
 setUrl ($url)
 
 setUserAgent ($userAgent)
 Set the User-Agent Header.
 
 toBatchString ($id)
 

Public Attributes

 $accessKey
 
const GZIP_UA = " (gzip)"
 

Protected Attributes

 $baseComponent = null
 
 $canGzip = null
 
 $expectedClass
 
 $expectedRaw = false
 
 $path
 
 $postBody
 
 $queryParams
 
 $requestHeaders
 
 $requestMethod
 
 $responseBody
 
 $responseHeaders
 
 $responseHttpCode
 
 $userAgent
 

Member Function Documentation

◆ canGzip()

Google_Http_Request::canGzip ( )

Can this request accept a gzip response?

Return values
bool

◆ getBaseComponent()

Google_Http_Request::getBaseComponent ( )

Misc function that returns the base url component of the $url used by the OAuth signing class to calculate the base string.

Return values
stringThe base url component of the $url.

◆ getCacheKey()

Google_Http_Request::getCacheKey ( )

Returns a cache key depending on if this was an OAuth signed request in which case it will use the non-signed url and access key to make this cache key unique per authenticated user, else use the plain request url.

Return values
stringThe md5 hash of the request cache key.

◆ getExpectedClass()

Google_Http_Request::getExpectedClass ( )

Retrieve the expected class the response should expect.

Return values
stringclass name

◆ getExpectedRaw()

Google_Http_Request::getExpectedRaw ( )

Expected raw response or not.

Return values
booleanexpected raw response

◆ getPostBody()

Google_Http_Request::getPostBody ( )
Return values
string\$postBodyHTTP Request Body.

◆ getQueryParams()

Google_Http_Request::getQueryParams ( )

Misc function that returns an array of the query parameters of the current url used by the OAuth signing class to calculate the signature.

Return values
arrayQuery parameters in the query string.

◆ getRequestHeader()

Google_Http_Request::getRequestHeader ( $key)
Parameters
string$key
Return values
array|booleanReturns the requested HTTP header or false if unavailable.

◆ getRequestHeaders()

Google_Http_Request::getRequestHeaders ( )
Return values
array\$headersHTTP Request Headers.

◆ getRequestMethod()

Google_Http_Request::getRequestMethod ( )
Return values
string\$methodHTTP Request Method.

◆ getResponseBody()

Google_Http_Request::getResponseBody ( )
Return values
stringHTTP Response Body

◆ getResponseHeader()

Google_Http_Request::getResponseHeader ( $key)
Parameters
string$key
Return values
array|booleanReturns the requested HTTP header or false if unavailable.

◆ getResponseHeaders()

Google_Http_Request::getResponseHeaders ( )
Return values
$responseHeaders(array) HTTP Response Headers.

◆ getResponseHttpCode()

Google_Http_Request::getResponseHttpCode ( )
Return values
stringHTTP Response Code.

◆ getUrl()

Google_Http_Request::getUrl ( )
Return values
string\$urlThe request URL.

◆ getUserAgent()

Google_Http_Request::getUserAgent ( )
Return values
stringThe User-Agent.

◆ setBaseComponent()

Google_Http_Request::setBaseComponent ( $baseComponent)

Set the base URL that path and query parameters will be added to.

Parameters
$baseComponentstring

◆ setExpectedClass()

Google_Http_Request::setExpectedClass ( $class)

Set the class the response to this request should expect.

Parameters
$classstring the class name

◆ setPostBody()

Google_Http_Request::setPostBody ( $postBody)
Parameters
string$postBodythe postBody to set

◆ setQueryParam()

Google_Http_Request::setQueryParam ( $key,
$value )

Set a new query parameter.

Parameters
$key- string to set, does not need to be URL encoded
$value- string to set, does not need to be URL encoded

◆ setRequestHeaders()

Google_Http_Request::setRequestHeaders ( $headers)
Parameters
array$headersThe HTTP request headers to be set and normalized.

◆ setRequestMethod()

Google_Http_Request::setRequestMethod ( $method)
Parameters
string$methodSet he HTTP Method and normalize it to upper-case, as required by HTTP.

◆ setResponseBody()

Google_Http_Request::setResponseBody ( $responseBody)
Parameters
string$responseBodyThe HTTP response body.

◆ setResponseHeaders()

Google_Http_Request::setResponseHeaders ( $headers)
Parameters
array$headersThe HTTP response headers to be normalized.

◆ setResponseHttpCode()

Google_Http_Request::setResponseHttpCode ( $responseHttpCode)
Parameters
int$responseHttpCodeHTTP Response Code.

◆ setUrl()

Google_Http_Request::setUrl ( $url)
Parameters
string$urlthe url to set

◆ setUserAgent()

Google_Http_Request::setUserAgent ( $userAgent)

Set the User-Agent Header.

Parameters
string$userAgentThe User-Agent.

◆ toBatchString()

Google_Http_Request::toBatchString ( $id)
Parameters
string$id
Return values
stringA string representation of the HTTP Request.

The documentation for this class was generated from the following file: