<?php
<?php
/**
* API GETMOVIE.CC
* =======================================================
* Автор: Rockem
* ICQ: 654485472
* =======================================================
* Файл: getmovie_api.php
* -------------------------------------------------------
* Версия: 2.0 (26.07.2016)
* =======================================================
*/
// Конфигурация модуля
$token = "b3ab2ae5e3e47a979f62bb757a285a5d"; // * Нужно указать обязательно
if($_GET["w"]) $width = $_GET["w"]."px"; else $width = "100%";
if($_GET["h"]) $height = $_GET["h"]."px"; else $height = "100%";
$kp_id = $_GET["kp_id"];
// Формируем GET запрос
$url = "https://getmovie.cc/api/videos.json?kinopoisk_id=".$kp_id."&api_token=".$token."&r=json";
$json = file_get_contents($url);
preg_match( '/embed_url":"(.*?)"/is' , $json, $file );
header("content-type: application/x-javascript");
echo "function createPlayer_video() {
var ifrm = document.createElement(\"IFRAME\");
ifrm.setAttribute(\"src\", \"".$file[1]."\");
ifrm.style.width = \"".$width."\";
ifrm.style.height = \"".$height."\";
ifrm.frameBorder = 0;
ifrm.setAttribute('scrolling', 'no');
var divMoon = document.getElementById(\"video-player\");
divMoon.appendChild(ifrm);
}
function addLoadEvent(func) {
var oldonload = window.onload;
if (typeof window.onload != 'function') {
window.onload = func;
} else {
window.onload = function() {
if (oldonload) {
oldonload();
}
func();
}
}
}
addLoadEvent(function() {
createPlayer_video();
});";