国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 語言 > PHP > 正文

PHP實現將優酷土豆騰訊視頻html地址轉換成flash swf地址的方法

2024-05-04 23:59:12
字體:
來源:轉載
供稿:網友

本文實例講述了PHP實現將優酷土豆騰訊視頻html地址轉換成flash swf地址的方法。分享給大家供大家參考,具體如下:

很多用戶不知道如何復制flash地址,只能在程序中幫他們替換了:

<?php/** * 支持優酷、土豆、騰訊視頻html到swf轉換 */function convert_html_to_swf($url = ''){  if(!is_string($url) || empty($url)) return ;  if(strpos($url, 'swf')) return $url;  preg_match_all('/http:////(.*?)?/.(.*?)?/.com//(.*)/', $url, $types);  $type = $types[2][0];  $domain = $types[1][0];  switch ($type) {    case 'youku' :      preg_match_all('/http:////v/.youku/.com//v_show//id_(.*)?/.html/', $url, $url_array);      $swf = 'http://player.youku.com/player.php/sid/' . str_replace('/', '', $url_array[1][0]) . '/v.swf';      break;    case 'tudou' :      $method = substr($types[3][0], 0, 1);      $method = $method == 'p' ? 'v' : $method;      preg_match_all('/http:////www.tudou/.com//(.*)?//(.*)?/', $url, $url_array);      $str_arr = explode('/', $url_array[1][0]);      $count = count($str_arr);      if ($count == 1) {        $id = explode('.', $url_array[2][0]);        $id = $id[0];      } else if ($count == 2) {        $id = $str_arr[1];      } else if ($count == 3) {        $id = $str_arr[2];      }      $swf = 'http://www.tudou.com/' . $method . '/' . $id . '/v.swf';      break;    case 'qq' :      $url_array = parse_url($url);      $swf = "http://static.video.qq.com/TPout.swf?{$url_array['query']}&auto=0";      break;    default :      $swf = $url;      break;  }  return $swf;}/** * 優酷視頻轉換測試 * html地址 http://v.youku.com/v_show/id_XNzU4Mzg2NDA4.html?f=22720170&ev=2&from=y1.1-2.10001-0.1-2 * swf地址 http://player.youku.com/player.php/sid/XNzU4Mzg2NDA4/v.swf */echo convert_html_to_swf("http://v.youku.com/v_show/id_XNzU4Mzg2NDA4.html?f=22720170&ev=2&from=y1.1-2.10001-0.1-2");echo "<hr>";/** * 騰訊視頻轉換測試 * * html地址 http://v.qq.com/cover/w/w5lb270k15j7ita.html?vid=v0015mnd5x6 * swf地址 http://static.video.qq.com/TPout.swf?vid=v0015mnd5x6&auto=0 */echo convert_html_to_swf("http://v.qq.com/cover/w/w5lb270k15j7ita.html?vid=v0015mnd5x6");echo "<hr>";/** * 土豆視頻轉換測試 * * html地址 http://www.tudou.com/albumplay/hqtp6W5XLN8/Kscjyz4J-RE.html * swf地址 http://www.tudou.com/a/hqtp6W5XLN8/&iid=132223533&resourceId=0_04_0_99/v.swf */echo convert_html_to_swf("http://www.tudou.com/albumplay/hqtp6W5XLN8/Kscjyz4J-RE.html");echo "<hr>";

希望本文所述對大家PHP程序設計有所幫助。


注:相關教程知識閱讀請移步到PHP教程頻道。
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表

圖片精選

主站蜘蛛池模板: 正镶白旗| 东丰县| 洛川县| 广南县| 定襄县| 永川市| 辰溪县| 绥德县| 西丰县| 临清市| 九寨沟县| 资阳市| 丰宁| 康乐县| 玛纳斯县| 武强县| 临清市| 探索| 东乡族自治县| 桐梓县| 宜兴市| 桐柏县| 日土县| 柳江县| 上高县| 苍梧县| 六枝特区| 溧水县| 桐城市| 武山县| 崇仁县| 广德县| 于都县| 洛宁县| 时尚| 普兰店市| 兴文县| 桂阳县| 陆良县| 循化| 丘北县|