Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- if(isset($_POST['video_url'])) $url= $_POST['video_url'];
- elseif (isset($_GET['video_url'])) $url = $_GET['video_url'];
- else $url = null;
- if ($url != null) {
- parse_str( parse_url( $url, PHP_URL_QUERY ), $my_array_of_vars );
- $video_id = $my_array_of_vars['v'];
- require_once ('unirest/Unirest.php');
- $response = Unirest\Request::get("https://ytapi.p.mashape.com/mp3?id=".$video_id,
- array(
- "X-Mashape-Key" => "eu3tTuvAS7mshdiKlbOo1PnqCkgjp1vAXcojsnmgR6OKvjMYA3",
- "Accept" => "application/json"
- )
- );
- header("Location: ".$response->body[0]->url);
- die();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement