The project was written on a temporary basis. To be perfected:
Copy CodeThe code is as follows:/*
* 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/779563.html www.bkjia.com true http://www.bkjia.com/PHPjc/779563.html techarticle the project was written on a temporary basis. To be perfected: Copy the Code code as follows:/* * Based on user submitted (swf/html) address, get Youku, potato swf Play address * */private Function _GETSW ...