In a microblogging project, the release video needs to parse out the chain to get the video address information,
Using the PHP curl to get the content, the regular parsing.
Later the test found that the potato video can not be resolved, the others are good.
After repeated testing, found that the potato with gzip compression, and then use Gzdecode anti-decompression.
Discover the local Wamp 2.1 zlib library, online cn.php.net search solution, Custom function Gzinflate implementation.
Here is the code
if (!function_exists (' Gzdecode ')) { function Gzdecode ($data) { $flags = Ord (substr ($data, 3, 1)); $headerlen = ten; $extralen = 0; $filenamelen = 0; if ($flags & 4) { $extralen = unpack (' V ', substr ($data, 2)); $extralen = $extralen [1]; $headerlen + = 2 + $extralen; } if ($flags & 8)//Filename $headerlen = Strpos ($data, Chr (0), $headerlen) + 1; if ($flags &)//Comment $headerlen = Strpos ($data, Chr (0), $headerlen) + 1; if ($flags & 2)//CRC at end of file $headerlen + = 2; $unpacked = @gzinflate (substr ($data, $headerlen)); if ($unpacked = = = FALSE) $unpacked = $data; return $unpacked; }}
Hope to be useful to everyone!