主流网盘地址解析流程

这里拿360的网盘地址解析示范,其它的网盘解析流程差不多,
有什么问题可以跟我交流
<?php

//$_id = http://yunpan.cn/QTRJtjVB4QktD ;
$_id = "QTRJtjVB4QktD";

$_url = 'http://yunpan.cn/lk/'.$_id;
$_str = Get_Web_Contents($_url);
$_str = $_str['Header'];

if (preg_match('#Location: (?<url>http://(?<dir>[w.]+).yunpan.cn/lk/w+)#',$_str,$_url) == 0){
    die('error!');
}

$_str = Get_Web_Contents($_url['url']);
$_str = $_str['Body'];

if (preg_match('#nid : '(d+)',#s',$_str,$_nid) == 0){
    die('error!');
}
$post_string = 'surl='.$_id.'&nid='.$_nid['1'];

$_url = 'http://'.$_url['dir'].'.yunpan.cn/share/downloadfile/';

$_str = Get_Web_Contents($_url, 'POST', $post_string);

$_str = $_str['Body'];

$_str = object_array(json_decode($_str));
$_url = $_str['data']['downloadurl'];
header('location:'.$_url);

function object_array($array){
    // 将 json_decode() 还原的数组对象转换成数组。
    if(is_object($array)){
        $array = (array)$array;
    }
    if(is_array($array)){
        foreach($array as $key=>$value){
            $array[$key] = object_array($value);
        }
    }
    return $array;
}
?>