Skip to content

Instantly share code, notes, and snippets.

@Sebastiansch
Created February 1, 2017 14:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Sebastiansch/ce07f400b59fdc5a13f95319688a0bb4 to your computer and use it in GitHub Desktop.
Save Sebastiansch/ce07f400b59fdc5a13f95319688a0bb4 to your computer and use it in GitHub Desktop.
$token = 'xxx';
$domainname = 'http://moodle.localhost';
/// FUNCTION NAME
$functionname = 'local_coursearchive_get_courses_to_update';
$serverurl = $domainname . '/webservice/xmlrpc/server.php'. '?wstoken=' . $token;
$post = '<?xml version="1.0" encoding="iso-8859-1"?><methodCall><methodName>local_coursearchive_get_courses_to_update</methodName></methodCall>';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $serverurl );
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1 );
curl_setopt($ch, CURLOPT_POST, 1 );
curl_setopt($ch, CURLOPT_POSTFIELDS, $post );
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: text/xml; charset=utf-8'));
$result=curl_exec ($ch);
print_r($result);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment