Below I will introduce to you a PHP get Youku Tudou page video SWF player address, temporary write not perfect friends can perfect and I share oh.
The code is as follows |
Copy Code |
The project was written on a temporary basis. Ready to be perfected
/* * Based on user-submitted (swf/html) address, get Youku, potato SWF play address * */ Private Function _getswf ($url = ") { if (Isset ($url) &&!empty ($url)) { Preg_match_all ('/http://(. *?)?. (. *?)?. com/(. *)/', $url, $types); }else{ return false; } $type = $types [2][0]; $domain = $types [1][0]; $isswf = Strpos ($types [3][0], ' v.swf ') = = = False? False:true; $method = substr ($types [3][0],0,1); Switch ($type) { Case ' Youku ': if ($domain = = ' Player ') { $swf = $url; }else if ($domain = = ' V ') { 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 '; }else{ $swf = $url; } Break Case ' Tudou ': if ($isswf) { $swf = $url; }else{ $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]) [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 Default: $swf = $url; Break } return $swf; } |
http://www.bkjia.com/PHPjc/633129.html www.bkjia.com true http://www.bkjia.com/PHPjc/633129.html techarticle below I will introduce to you a PHP get Youku Tudou page video SWF player address, temporary write not perfect friends can perfect and I share oh. Code to copy code as follows ...