Advertisement
Guest User

Untitled

a guest
Feb 11th, 2016
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.66 KB | None | 0 0
  1. <html>
  2. <head>
  3. <title>PHP Test</title>
  4. </head>
  5. <body>
  6.  
  7. <?php
  8.  
  9. /**
  10. * Send a GET requst using cURL
  11. * @param string $url to request
  12. * @param array $get values to send
  13. * @param array $options for cURL
  14. * @return string
  15. */
  16. function curl_get($url, array $get = NULL, array $options = array())
  17. {
  18. $defaults = array(
  19. CURLOPT_URL => $url. (strpos($url, '?') === FALSE ? '?' : ''). http_build_query($get),
  20. CURLOPT_HEADER => 0,
  21. CURLOPT_RETURNTRANSFER => TRUE,
  22. CURLOPT_TIMEOUT => 4
  23. );
  24.  
  25. $ch = curl_init();
  26. curl_setopt_array($ch, ($options + $defaults));
  27. if( ! $result = curl_exec($ch))
  28. {
  29. trigger_error(curl_error($ch));
  30. }
  31. curl_close($ch);
  32. return $result;
  33. }
  34.  
  35. if ($_SERVER['REQUEST_METHOD'] == 'POST') {
  36.  
  37. $st = isset($_POST['search_text']) ? $_POST['search_text'] : false;
  38.  
  39.  
  40. $init_url = "www.sbs.com.au/ondemand/video/single/" . $st . "?context=web";
  41.  
  42. $data = curl_get($init_url);
  43.  
  44. preg_match("/link\.theplatform\.com.*?m3u/", $data, $matches);
  45.  
  46. $first_url = str_replace("\/", "/", $matches[0]);
  47.  
  48. $second_data = curl_get($first_url);
  49.  
  50. preg_match("/https:\/\/sbsvodns.*?=off/", $second_data, $second_url);
  51.  
  52. $third_data = curl_get($second_url[0]);
  53.  
  54. preg_match("/http.*?$/", $third_data, $third_url);
  55.  
  56. $ffmpeg_1280 = str_replace("index_3", "index_0", $third_url[0]);
  57.  
  58. echo "The URL to feed to ffmpeg is: \n<br><br>";
  59. print $ffmpeg_1280;
  60. echo "\n<br><br>";
  61.  
  62.  
  63.  
  64. } // end if form was submitted
  65.  
  66. ?>
  67.  
  68. <html>
  69. <body>
  70. <form method="post">
  71. <input type="text" name="search_text" placeholder="unique show ID">
  72. </form>
  73. </body>
  74. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement