Skip to content

Instantly share code, notes, and snippets.

@pascallaliberte
Last active August 29, 2015 14:00
Show Gist options
  • Save pascallaliberte/21d3eb14ec6e5a8dec9a to your computer and use it in GitHub Desktop.
Save pascallaliberte/21d3eb14ec6e5a8dec9a to your computer and use it in GitHub Desktop.
Reproducing the file_get_contents error while retrieving a waxlrs XML configuration
<?php
$configuration_url = 'https://uomedtest.waxlrs.com/lti?u=https://uomedtest.waxlrs.com/embed/mostpopular';
$opts = array(
'http' => array(
'header' => "Accept: application/xml\r\n"
)
);
$context = stream_context_create($opts);
$config_string = file_get_contents($configuration_url, false, $context);
/*
file_get_contents produces this error:
Warning: file_get_contents(https://uomedtest.waxlrs.com/lti?u=https://uomedtest.waxlrs.com/embed/mostpopular): failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found in /var/www/html/test.php on line 12
*/
$config = simplexml_load_string($config_string);
$launch_url = (string) $config->children('blti', true)->launch_url;
echo $launch_url;
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment