mirror of
https://github.com/moodle/moodle.git
synced 2025-08-04 08:26:37 +02:00

* Remove description array => all these information are now into the phpdoc. Remove all call/reference to moodleexternal.php * Adapt our own REST server to these changes * Remove Zend REST server as it's going to be deprecated in Zend Framework 1.8 * Remove our own SOAP server as we use the Zend SOAP server
66 lines
1.6 KiB
PHP
66 lines
1.6 KiB
PHP
<?php
|
|
/**
|
|
* Created on 10/17/2008
|
|
*
|
|
* Rest Test Client
|
|
*
|
|
* @author David Castro Garcia
|
|
* @author Ferran Recio Calderó
|
|
* @author Jerome Mouneyrac
|
|
*/
|
|
|
|
require_once ('config_rest.php');
|
|
|
|
$params = array('search');
|
|
|
|
foreach ($params as $param) {
|
|
$$param = (isset($_POST[$param]))?$_POST[$param]:'';
|
|
}
|
|
|
|
start_interface("List of Users");
|
|
?>
|
|
|
|
<form action="getusers.php" method="post">
|
|
<table border="0">
|
|
<tr><td>Search: </td><td><input type="text" name="search" value="<?php echo $search; ?>"/></td></tr>
|
|
<tr><td></td><td><input type="submit" value="Find Users"></td></tr>
|
|
</table>
|
|
</form>
|
|
|
|
<?php
|
|
|
|
if ($search) {
|
|
$data['search'] = $search;
|
|
|
|
var_dump($CFG->serverurl.'/user/tmp_get_users');
|
|
|
|
|
|
//we are asking for a token
|
|
$connectiondata['username'] = 'wsuser';
|
|
$connectiondata['password'] = 'wspassword';
|
|
$ch = curl_init();
|
|
curl_setopt($ch, CURLOPT_URL, $CFG->serverurl.'/user/tmp_get_token');
|
|
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
|
curl_setopt($ch, CURLOPT_POST, 1);
|
|
curl_setopt($ch, CURLOPT_POSTFIELDS, format_postdata($connectiondata));
|
|
$token = curl_exec($ch);
|
|
$data['token'] = $token;
|
|
|
|
$ch = curl_init();
|
|
curl_setopt($ch, CURLOPT_URL, $CFG->serverurl.'/user/tmp_get_users');
|
|
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
|
curl_setopt($ch, CURLOPT_POST, 1);
|
|
curl_setopt($ch, CURLOPT_POSTFIELDS, format_postdata($data));
|
|
$out = curl_exec($ch);
|
|
|
|
$res = basicxml_xml_to_object($out);
|
|
show_object($res->user,2,'auth');
|
|
|
|
show_xml ($out);
|
|
} else {
|
|
echo "<p>Fill the form first</p>";
|
|
}
|
|
|
|
end_interface();
|
|
|
|
?>
|