Code _php tips for using PHP to extract flash addresses from a video site page

Source: Internet
Author: User
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:

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;
$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 :// "/>
Then use the regular expression to match the address segment out, OK.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.