|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?注册
×
很简单的东西,文件很小滴说。本来是用file_get_contents()的,不过居然防盗链。汗一个~!
- <form action="">
- <input type="text" name="url" id="url" size="100"><input type="submit" value="Submit">
- </form>
- <?PHP
- //====================================================
- // FileName: youku.php
- // Summary: 获取优酷视频的真实地址
- // Author: millken(迷路林肯)
- // LastModifed:2007-07-24
- // copyright (c)2007 millken@gmail.com
- //====================================================
- $url = empty($_GET['url'])?die():$_GET['url'];
- $opts = array(
- 'http'=>array(
- 'method'=>"GET",
- 'header'=>"Accept: */*\r\n" .
- "Referer: http://www.youku.com/\r\n"
- )
- );
- $context = stream_context_create($opts);
- /* Sends an http request to $url with additional headers shown above */
- $fp = fopen($url, 'rb', false, $context);
- $fpcontent = "";
- while(!feof($fp)){$fpcontent .= fread($fp,4096);}
- fclose($fp);
- preg_match("/[A-Z0-9]{38}-[A-Z0-9]{4}-[A-Z0-9]{4}-[A-Z0-9]{4}-[A-Z0-9]{12}/",$fpcontent,$fileid);
- //0100643AA2452A84A6E50A0003F696993AD6AF-C0C1-37E4-7D85-5C49409E9684
- $surl = "http://www.youku.com/player/getFlvPath/fileid/".$fileid[0];
- echo "<a href=".file_get_contents($surl).">download this video</a>";
- ?>
复制代码 |
|