Created
July 12, 2016 21:02
-
-
Save jixserver/7fa8015f59dffe72ccc2271ee2bebcd9 to your computer and use it in GitHub Desktop.
[UPDATE] YouTube V3api Supports 99% Videos (including VEVO and AGE restricted videos)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /* ******************************* | |
| yTube.MOBI v3api | |
| This script check if you have curl or file_get_contents | |
| enabled on your server and uses the function that is enabled | |
| you can call the script like this: require_once('yt.php'); | |
| or you can simply copy/paste this code in your file | |
| if you need help contact me: http://ytube.mobi/contact/ | |
| ******************************* */ | |
| $id = isset($_GET['id']) ? $_GET['id'] : ''; | |
| $site = 'your site name'; | |
| $host = $_SERVER['HTTP_HOST']; | |
| if (function_exists('curl_version')) | |
| { | |
| $ch = curl_init(); | |
| curl_setopt($ch, CURLOPT_URL, 'http://ytube.mobi/yt.php?videoid='.$id.'&site='.$site.''); | |
| curl_setopt($ch, CURLOPT_REFERER, $host); | |
| curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); | |
| curl_setopt($ch, CURLOPT_TIMEOUT, 5); | |
| $ytube = curl_exec($ch); | |
| curl_close($ch); | |
| } | |
| else if (file_get_contents(__FILE__) && ini_get('allow_url_fopen')) | |
| { | |
| $opts = array( | |
| 'http'=>array( | |
| 'method'=>"GET", | |
| 'header'=>"Origin: $host" | |
| ) | |
| ); | |
| $ytube = file_get_contents('http://ytube.mobi/yt.php?videoid='.$id.'&site='.$site.'', false, stream_context_create($opts)); | |
| } | |
| else | |
| { | |
| echo 'You have neither cUrl installed nor allow_url_fopen activated. Please setup one of those!'; | |
| } | |
| echo $ytube; //use $ytube; where you want to display the download links | |
| ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment