Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <html>
- <head>
- <title>PHP Test</title>
- </head>
- <body>
- <?php
- /**
- * Send a GET requst using cURL
- * @param string $url to request
- * @param array $get values to send
- * @param array $options for cURL
- * @return string
- */
- function curl_get($url, array $get = NULL, array $options = array())
- {
- $defaults = array(
- CURLOPT_URL => $url. (strpos($url, '?') === FALSE ? '?' : ''). http_build_query($get),
- CURLOPT_HEADER => 0,
- CURLOPT_RETURNTRANSFER => TRUE,
- CURLOPT_TIMEOUT => 4
- );
- $ch = curl_init();
- curl_setopt_array($ch, ($options + $defaults));
- if( ! $result = curl_exec($ch))
- {
- trigger_error(curl_error($ch));
- }
- curl_close($ch);
- return $result;
- }
- if ($_SERVER['REQUEST_METHOD'] == 'POST') {
- $st = isset($_POST['search_text']) ? $_POST['search_text'] : false;
- $init_url = "www.sbs.com.au/ondemand/video/single/" . $st . "?context=web";
- $data = curl_get($init_url);
- preg_match("/link\.theplatform\.com.*?m3u/", $data, $matches);
- $first_url = str_replace("\/", "/", $matches[0]);
- $second_data = curl_get($first_url);
- preg_match("/https:\/\/sbsvodns.*?=off/", $second_data, $second_url);
- $third_data = curl_get($second_url[0]);
- preg_match("/http.*?$/", $third_data, $third_url);
- $ffmpeg_1280 = str_replace("index_3", "index_0", $third_url[0]);
- echo "The URL to feed to ffmpeg is: \n<br><br>";
- print $ffmpeg_1280;
- echo "\n<br><br>";
- } // end if form was submitted
- ?>
- <html>
- <body>
- <form method="post">
- <input type="text" name="search_text" placeholder="unique show ID">
- </form>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement