Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /**
- * GOLDVOD by stream-recorder.pl
- */
- $login = "";
- $password = "";
- $port = "80";
- $location = "Holandia";
- $quality = "hd";
- // Statyczny numer kanału
- $channel_number = "";
- // Nadawanie
- $rtmp_out = "";
- function getCurl($url, $postdata) {
- $ch = curl_init($url);
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
- curl_setopt($ch, CURLOPT_POSTFIELDS, $postdata);
- curl_setopt($ch, CURLOPT_HTTPHEADER, array(
- 'User-Agent: XBMC',
- 'ContentType: application/x-www-form-urlencoded'
- ));
- $results = curl_exec($ch);
- curl_close($ch);
- return $results;
- }
- while (1 == 1) {
- $url = "http://185.35.139.177/api/index.php?page=get_tv_channels";
- $data = http_build_query(
- array(
- 'login' => $login,
- 'pass' => $password,
- 'location' => $location,
- 'port' => $port,
- 'type' => 'online'
- )
- );
- $channels = getCurl($url, $data);
- echo "===CHANNELS=== \n";
- $channels_list = [];
- foreach(json_decode($channels) as $channel)
- {
- echo $channel->id . " - " . $channel->name . "\n";
- $channels_list[$channel->id] = $channel->name;
- }
- if(!$channel_number) {
- echo "Select channel id: ";
- $channel_number = trim(fgets(STDIN));
- }
- if(!isset($channels_list[$channel_number])) {
- echo "Channel not found \n";
- die();
- }
- $url = "http://185.35.139.177/api/index.php?page=get_tv_channel";
- $data = http_build_query(
- array(
- 'login' => $login,
- 'pass' => $password,
- 'location' => $location,
- 'port' => $port,
- 'id' => $channel_number
- )
- );
- $result = getCurl($url, $data);
- if(!$result) {
- die();
- }
- $result = json_decode($result);
- if($quality === 'hd' && !empty($result->url_hd)) {
- $r = $result->url_hd;
- } else {
- $r = $result->url_sd;
- }
- echo "===START=== \n";
- if($rtmp_out) {
- // restream by ffmpeg
- $cmd = 'ffmpeg -i "' . $r . '" -acodec copy -vcodec copy -f flv '. $rtmp_out;
- } else {
- // watch in ffplay
- $cmd = 'ffplay -i "' . $r . '"';
- }
- // start SHOW!
- shell_exec($cmd);
- // sleep from 30 to 90 seconds
- sleep(rand(30, 90));
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement