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.

Differences Between: [Versions 310 and 402] [Versions 311 and 402] [Versions 39 and 402] [Versions 400 and 402] [Versions 401 and 402]

An XML-RPC client

Author: Donal McMullan donal@catalyst.net.nz
License: http://www.gnu.org/copyleft/gpl.html GNU Public License
Version: 0.0.1
File Size: 404 lines (17 kb)
Included or required:0 times
Referenced: 5 times
Includes or requires: 0 files

Defines 1 class

mnet_xmlrpc_client:: (7 methods):
  __construct()
  set_timeout()
  set_method()
  add_param()
  send()
  permission_to_call()
  prepare_http_request()


Class: mnet_xmlrpc_client  - X-Ref

Class representing an XMLRPC request against a remote machine

__construct()   X-Ref
Constructor


set_timeout($timeout)   X-Ref
Allow users to override the default timeout

param: int $timeout    Request timeout in seconds

set_method($xmlrpcpath)   X-Ref
Set the path to the method or function we want to execute on the remote
machine. Examples:
mod/scorm/functionname
auth/mnet/methodname
In the case of auth and enrolment plugins, an object will be created and
the method on that object will be called


add_param($argument, $type = 'string')   X-Ref
Add a parameter to the array of parameters.

param: string  $argument    A transport ID, as defined in lib.php
param: string  $type        The argument type, can be one of:
return: bool                 True on success

send($mnet_peer, bool $rekey = false)   X-Ref
Send the request to the server - decode and return the response

param: object   $mnet_peer      A mnet_peer object with details of the
param: bool     $rekey         The rekey attribute stops us from
return: mixed                    A PHP variable, as returned by the

permission_to_call($mnet_peer)   X-Ref
Check that we are permitted to call method on specified peer

param: object $mnet_peer A mnet_peer object with details of the remote host we're connecting to
return: bool True if we permit calls to method on specified peer, False otherwise.

prepare_http_request($mnet_peer)   X-Ref
Generate a \PhpXmlRpc\Client handle and prepare it for sending to an mnet host

param: object $mnet_peer A mnet_peer object with details of the remote host the request will be sent to
return: \PhpXmlRpc\Client handle - the almost-ready-to-send http request