Skip to content

Instantly share code, notes, and snippets.

@FabianPastor
Created September 18, 2018 18:56
Show Gist options
  • Save FabianPastor/ce23433d6c523ea6ffa002220e4801e8 to your computer and use it in GitHub Desktop.
Save FabianPastor/ce23433d6c523ea6ffa002220e4801e8 to your computer and use it in GitHub Desktop.
Pequeño script para usar la API REST de Moodle del AulaVirtual de la Universidad de Valencia
#!/usr/bin/php
<?php
$function = "core_webservice_get_site_info";
$host = "https://aulavirtual.uv.es";
$apiRest = "/webservice/rest/server.php";
$token = "0123456789";
$options = new stdClass();
$options->moodlewsrestformat = "json";
$options->wstoken = $token;
$options->wsfunction = $function;
$url = $host.$apiRest."?".http_build_query($options);
var_dump(json_decode(file_get_contents($url)));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment