Skip to content

Instantly share code, notes, and snippets.

@jleyva
Created April 3, 2014 13:48
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 jleyva/9954692 to your computer and use it in GitHub Desktop.
Save jleyva/9954692 to your computer and use it in GitHub Desktop.
client_airnotifier_preferences.php
<?php
// This file is NOT a part of Moodle - http://moodle.org/
//
// This client for Moodle 2 is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
/// SETUP - NEED TO BE CHANGED
//
// Token
$token = '298dee2e40eeac025a642e6231599917';
$domainname = 'http://localhost/moodlebugs';
// REST RETURNED VALUES FORMAT
$restformat = 'json'; //Also possible in Moodle 2.2 and later: 'json'
//Setting it to 'json' will fail all calls on earlier Moodle version
$restformat = ($restformat == 'json')?'&moodlewsrestformat=' . $restformat:'';
/// REST CALL
header('Content-Type: text/plain');
require_once('./curl.php');
$curl = new curl;
$functionname = 'message_airnotifier_are_notification_preferences_configured';
$params = array('userids' => array(2, 3, 4));
$serverurl = $domainname . '/webservice/rest/server.php'. '?wstoken=' . $token . '&wsfunction='.$functionname;
$resp = $curl->post($serverurl . $restformat, $params);
$resp = json_decode($resp);
print_r($resp);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment