Advertisement
SlaSerX

Untitled

Apr 17th, 2017
328
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.25 KB | None | 0 0
  1. <?PHP
  2. 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");
  3. $channel = $_GET["id"];
  4. set_time_limit(60);
  5. $file = "/var/www/html/bscfusion-grabepg/bulsat.m3u";
  6.  
  7.  
  8. if ( file_exists($file) && filemtime($file) >= strtotime("6 hours ago") ){
  9. // do stuff if file hasn't been modified within the past 6 hours
  10. $a = $a.'b';
  11. } else {
  12. // Get stream via python
  13. $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');
  14. $output = shell_exec($command);
  15. #echo $output;
  16. }
  17.  
  18.  
  19. $filestring = file_get_contents($file, true);// file into string
  20. #print $filestring;
  21.  
  22. #http://regex101.com/#PCRE
  23. $pattern = "/(http:\/.*$channel.*)/";
  24. if ($c=preg_match_all ($pattern, $filestring, $matches))
  25. {
  26. $var1 = $matches[0][0];
  27. # $var1=str_replace("|User-Agent=samsunghas-agent%2F1.1", "", $var1);
  28. $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$
  29. # print "$var1";
  30. }
  31.  
  32.  
  33.  
  34. header("Content-type: application/vnd.apple.mpegurl");
  35. header("Location: $var1");
  36.  
  37. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement