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.

This file contains the class moodle_google_curlio.

Copyright: 2013 Frédéric Massart
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 204 lines (7 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

moodle_google_curlio:: (6 methods):
  do_request()
  executeRequest()
  setOptions()
  setTimeout()
  getTimeout()
  get_option_name_from_constant()


Class: moodle_google_curlio  - X-Ref

Class moodle_google_curlio.

The initial purpose of this class is to add support for our
class curl in Google_IO_Curl. It mostly entirely overrides it.

do_request($curl, $request)   X-Ref
Send the request via our curl object.

return: string result of the request.
param: curl $curl prepared curl object.
param: Google_HttpRequest $request The request.

executeRequest(Google_Http_Request $request)   X-Ref
Execute an API request.

This is a copy/paste from the parent class that uses Moodle's implementation
of curl. Portions have been removed or altered.

return: Google_Http_Request http request with the response http code, response
param: Google_Http_Request $request the http request to be executed

setOptions($optparams)   X-Ref
Set curl options.

We overwrite this method to ensure that the data passed meets
the requirement of our curl implementation and so that the keys
are strings, and not curl constants.

return: void
param: array $optparams Multiple options used by a cURL session.

setTimeout($timeout)   X-Ref
Set the maximum request time in seconds.

Overridden to use the right option key.

param: $timeout in seconds

getTimeout()   X-Ref
Get the maximum request time in seconds.

Overridden to use the right option key.

return: timeout in seconds.

get_option_name_from_constant($constant)   X-Ref
Return the name of an option based on the constant value.

return: string name of the constant if found, or throws exception.
param: int $constant value of a CURL constant.