Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.2.x will end 22 April 2024 (12 months).
  • Bug fixes for security issues in 4.2.x will end 7 October 2024 (18 months).
  • PHP version: minimum PHP 8.0.0 Note: minimum PHP version has increased since Moodle 4.1. PHP 8.1.x is supported too.

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.

param: curl $curl prepared curl object.
param: Google_HttpRequest $request The request.
return: string result of 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.

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

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.

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

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.

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