美拍解析php代码,视频解析,玩转代码采集解析php。
- <?php
- preg_match('|data-video="(.*?)"|',file_get_contents($_GET['u']),$video);
- echo decode($video[1]);
- function getHex($param1) {
- return array(
- "str" => substr($param1, 4),
- "hex" => strrev(substr($param1, 0, 4))
- );
- }
-
- function getDec($param1) {
- $loc2 = strval(intval($param1, 16));
- return array(
- "pre" => str_split(substr($loc2, 0, 2)),
- "tail" => str_split(substr($loc2, 2))
- );
- }
-
- function mysubstr($param1, $param2) {
- $loc1 = intval($param2[0]);
- $loc2 = intval($param2[1]);
- return substr($param1, 0, $loc1) . substr($param1, $loc1 + $loc2);
- }
-
- function getPos($param1, $param2) {
- $loc1 = intval($param2[0]);
- $loc2 = intval($param2[1]);
- $param2[0] = strlen($param1) - $loc1 - $loc2;
- return $param2;
- }
-
- function decode($encoded_string) {
- $dict2 = getHex($encoded_string);
- //var_dump($dict2);
- $dict3 = getDec($dict2['hex']);
- //var_dump($dict3);
- $str4 = mysubstr($dict2['str'], $dict3['pre']);
- //var_dump($str4);
- return base64_decode(mysubstr($str4, getPos($str4, $dict3['tail'])));
- }
- ?>
复制代码
|