コード例 #1
0
        $add = array('filename' => $name, 'size' => $size);
        //补充信息
        $res = object_array(json_decode($response));
        $res = array_merge($res, $add);
        echo json_encode($res);
    } else {
        $res = array('errno' => $errno, 'errmsg' => $errmsg);
        echo json_encode($res);
    }
} else {
    if (strstr($content, "varSYS_CONF")) {
        //echo '进入普通文件解析<br>';
        $nid = Search_string($content, "nid:'", "'");
        $email = Search_string($content, "email:'", "'");
        $name = Search_string($content, "name:'", "'");
        $surl = Search_string($content, "surl:'", "'");
        //echo $nid.'<br>'.$email.'<br>'.$surl;
        //$cookie='user_visit_token_cHA8QjbyxkN5e=83850b9685cb9faef7337055d928f88c.1449369079; path=/; domain=yunpan.cn';
        //这里的Cookie必须重新设置一下,否则下面的Header无法设置成功
        $cookie = explode(';', $cookie)[0] . ';';
        $data = array('nid' => $nid, 'shorturl' => $surl);
        $downurl = 'http://c43.yunpan.360.cn/share/downloadfile/';
        $headers = array('User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; zh-CN; rv:1.9) Gecko/2008052906 Firefox/3.0', 'Referer: http://c43.yunpan.360.cn/share/downloadfile/', 'Content-type:application/x-www-form-urlencoded');
        $ch = curl_init($downurl);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
        curl_setopt($ch, CURLOPT_HEADER, 0);
        curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 120);
        curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
        curl_setopt($ch, CURLOPT_POST, true);
        curl_setopt($ch, CURLOPT_COOKIE, $cookie);
        //Header无法改变和$cookie取值有关,晕死了。。。
コード例 #2
0
    	**************/
}
//成功进入文件分享页面,接下来一个POST就可以了
if (strpos($content, 'fs_id')) {
    $isdir = Search_string($content, "\"isdir\":", ",");
    if ($isdir == "1") {
        $errmsg = "目前暂不支持对文件夹的解析!";
        $res = array("errno" => $errno, "errmsg" => $errmsg);
        echo json_encode($res);
        return;
    }
    $fs_id = Search_string($content, "yunData.FS_ID=\"", "\"");
    $uk = Search_string($content, "yunData.SHARE_UK=\"", "\"");
    $shareid = Search_string($content, "\"shareid\":", ",");
    $sign = Search_string($content, "sign\":\"", "\"");
    $timestamp = Search_string($content, "\"timestamp\":", ",");
    //$durl = "http://pan.baidu.com/api/sharedownload?sign=".$sign."&tamp=".$timestamp."&bdstoken=&channel=chunlei&clienttype=0&web=1&app_id=250528";
    $durl = "http://pan.baidu.com/api/sharedownload?http://pan.baidu.com/api/sharedownload?uk=" . $uk . "&shareid=" . $shareid . "&timestamp=" . $timestamp . "&sign=" . $sign . "&fid_list=[" . $fs_id . "]";
    $postdata = 'encrypt=0&extra=%7B%22sekey%22%3A%22null%22%7D&product=share&primaryid=' . $shareid . '&shareid=' . $shareid . '&uk=' . $uk . '&fid_list=%5B' . $fs_id . '%5D&type=dlink';
    //echo $postdata;
    $data = array('encrypt' => '0', 'fid_list' => "[" . (string) $fs_id . "]", 'primaryid' => $shareid, 'product' => 'share', 'uk' => $uk, 'extra' => '{"sekey":"null"}', 'shareid' => $shareid, 'type' => 'dlink');
    $headers = array('User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; zh-CN; rv:1.9) Gecko/2008052906 Firefox/3.0', 'Content-type:application/x-www-form-urlencoded; charset=UTF-8', 'X-Requested-With:XMLHttpRequest');
    $ch = curl_init($durl);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_HEADER, 0);
    curl_setopt($ch, CURLOPT_REFERER, $url);
    curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 120);
    curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
    curl_setopt($ch, CURLOPT_POST, true);
    curl_setopt($ch, CURLOPT_COOKIE, $cookie);
    //Header无法改变和$cookie取值有关,晕死了。。。
コード例 #3
0
        //补充信息
        $res = object_array(json_decode($response));
        $res = array_merge($res, $add);
        echo json_encode($res);
    } else {
        $res = array('errno' => $errno, 'errmsg' => $errmsg);
        echo json_encode($res);
    }
} else {
    if (strstr($content, "varSYS_CONF")) {
        //echo '进入普通文件解析<br>';
        $nid = Search_string($content, "nid:'", "'");
        $email = Search_string($content, "email:'", "'");
        $name = Search_string($content, "name:'", "'");
        $surl = Search_string($content, "surl:'", "'");
        $download_permit_token = Search_string($content, "download_permit_token:'", "'");
        if ($download_permit_token == "" && empty($mycookie)) {
            $res = array('errno' => '5', 'errmsg' => '暂不支持对大文件的解析');
            echo json_encode($res);
            return;
        }
        //echo $nid.'<br>'.$email.'<br>'.$surl;
        //$cookie='user_visit_token_cHA8QjbyxkN5e=83850b9685cb9faef7337055d928f88c.1449369079; path=/; domain=yunpan.cn';
        //这里的Cookie必须重新设置一下,否则下面的Header无法设置成功
        $cookie = explode(';', $cookie)[0] . ';';
        $cookie = $cookie . $mycookie;
        $downurl = 'http://c11.yunpan.360.cn/share/downloadfile?shorturl=' . $surl . '&nid=' . $nid . '&download_permit_token=' . $download_permit_token;
        $headers = array('User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; zh-CN; rv:1.9) Gecko/2008052906 Firefox/3.0', 'Referer: http://c43.yunpan.360.cn/share/downloadfile/', 'Content-type:application/x-www-form-urlencoded');
        $ch = curl_init($downurl);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
        curl_setopt($ch, CURLOPT_HEADER, 0);