Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?PHP
- ini_set("user_agent","Mozilla/5.0 (SMART-TV; X11; Linux Tizen 2.3.0) AppleWebKit/538.1 (KHTML, like Gecko) SamsungBrowser/1.1 TV Safari/538.1");
- $channel = $_GET["id"];
- set_time_limit(60);
- $file = "/var/www/html/bscfusion-grabepg/bulsat.m3u";
- if ( file_exists($file) && filemtime($file) >= strtotime("6 hours ago") ){
- // do stuff if file hasn't been modified within the past 6 hours
- $a = $a.'b';
- } else {
- // Get stream via python
- $command = escapeshellcmd('/usr/bin/python /var/www/html/bscfusion-grabepg/bsc_grab.py -d 1 -u user -p pass -o /var/www/html/bscfusion-grabepg/ -m');
- $output = shell_exec($command);
- #echo $output;
- }
- $filestring = file_get_contents($file, true);// file into string
- #print $filestring;
- #http://regex101.com/#PCRE
- $pattern = "/(http:\/.*$channel.*)/";
- if ($c=preg_match_all ($pattern, $filestring, $matches))
- {
- $var1 = $matches[0][0];
- # $var1=str_replace("|User-Agent=samsunghas-agent%2F1.1", "", $var1);
- $var1=str_replace("|User-Agent=Mozilla%2F5.0+%28SMART-TV%3B+Linux%3B+Tizen+2.3%29+AppleWebkit%2F538.1+%28KHTML%2C+like+Gecko%29+SamsungBrowser%2F1.0+TV+Safari%2$
- # print "$var1";
- }
- header("Content-type: application/vnd.apple.mpegurl");
- header("Location: $var1");
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement