I'm making a html page that needs to show a video.The URL of the video is found in a jsondecode
output. Is here any way to pick pieces from that JSON
output and use it in my html page? I have tried POST and GET and echo but it doesn't seem to work.
To be clear: I'm trying to get it from a php file to a separate HTML file.
The JSON
response is in a separate file in a function.
public function getURL(){
$server_url= ilObjPresentations2GoGUI::getServerUrl();
$secret_key= ilObjPresentations2GoGUI::getSecretKey();
$authorized_group= ilObjPresentations2GoGUI::getAuthorizedGroup();
$link_usable= ilObjPresentations2GoGUI::getLinkUsable();
$query = 'technology';
$date = new DateTime('NOW');
$ts = $date->format('Y-m-d\TH:i:s');
$interval = 'PT' . $this->link_usable . 'H';
$date->add(new DateInterval('PT' . $link_usable . 'H'));
$expired = $date->format('Y-m-d\TH:i:s');
$url = $server_url . '?action=search&query='. $query . '&group='. $authorized_group . '&ts=' . $ts . '&expired=' .$expired;
$token = ilObjPresentations2GoAPI::create($url,$secret_key);
$goodurl = $url . '&token=' . $token;
$json = file_get_contents($goodurl);
$the_data = json_decode($json, true);}
Output:
array(9) { ["schemaVersion"]=> string(3) "1.0" ["catalogueVersion"]=> string(14) "4.0.5651.20898" ["encoding"]=> string(5) "UTF-8" ["action"]=> string(6) "search" ["query"]=> string(10) "technology" ["page"]=> string(1) "1" ["pageCount"]=> string(1) "1" ["success"]=> string(4) "true" ["response"]=> array(3) { [0]=> array(10) { ["id"]=> string(6) "bWKUL2" ["title"]=> string(57) "Technology-Based Professional Learning and Support Models" ["date"]=> string(19) "2011-12-05T10:19:21" ["contributors"]=> string(0) "" ["thumbnailUrl"]=> string(409) "https://DEMO-FORMS.presentations2go.eu/P2G/plugins/mediaservice.aspx?
(this is not all, but otherwise it would have been half a page)