Beispiel #1
0
<?php

ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
header("Access-Control-Allow-Origin: *");
header("Content-Type: application/json");
require_once __DIR__ . "/YouTube.php";
$result = array();
foreach (explode(",", $_GET["vid"]) as $vid) {
    $video = new YouTube($vid, isset($_GET["Cache"]) && $_GET["Cache"] === "false" ? false : true);
    array_push($result, array("id" => $video->getVideoID(), "title" => $video->getTitle(), "video" => array("url" => $video->getVideoURL(), "path" => $video->getVideoPath()), "audio" => array("url" => $video->getAudioURL(), "path" => $video->getAudioPath())));
}
YouTube::ClearCache();
echo json_encode($result);