Then I use PHP to achieve this function, I think using PHP to do this work is a kind of enjoyment! With its powerful HTML page-handling functions and regular expressions, just a few lines of code can handle this functionality.
Post Key code:
Copy Code code as follows:
<?php
Get the flash address in the Youku page
function Get_flash_url ($url)
{
$lines = file ($url);
foreach ($lines as $linenum => $line) {
Preg_match_all (' |<input type= "text" id= "Link2" value= "([^<>]+)"/>| ", $line, $result);
$swfurl = $result [1][0];
if (!empty ($swfurl))
return $swfurl;
}
}
?>
<?php
$url =$_server["Query_string"];
$flashurl = Get_flash_url ($url);
Echo ($flashurl);
?>
For example, this file we save as test.php, then we only need to run test.php video URL can be resolved out of the flash address.
The idea is simply to look at the features of the key Flash address section in the HTML code of the Youku video page first. Just look for a Web page, like we can see this section:
<div class= "Item" ><span class= "label" >flash Address: </span> <input type= "text" id= "link2" value= "http ://player.youku.com/player.php/sid/xmtu1mzcxmzaw/v.swf "/>
Then use the regular expression to match the address segment out, OK.