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