alltube/json.php
2015-10-29 20:43:43 +01:00

24 lines
675 B
PHP

<?php
/**
* PHP web interface for youtube-dl (http://rg3.github.com/youtube-dl/)
* JSON API
*
* PHP Version 5.3.10
*
* @category Youtube-dl
* @package Youtubedl
* @author Pierre Rudloff <contact@rudloff.pro>
* @license GNU General Public License http://www.gnu.org/licenses/gpl.html
* @link http://rudloff.pro
* */
use Alltube\VideoDownload;
require_once 'common.php';
if (isset($_GET["url"])) {
header('Content-Type: application/json');
try {
$video = VideoDownload::getJSON($_GET["url"]);
echo json_encode($video);
} catch (Exception $e) {
echo json_encode(array('success'=>false, 'error'=>$e->getMessage()));
}
}