suning云盘解析源码[PHP]

作者:matrix 被围观: 26,473 次 发布时间:2015-10-29 分类:PHP | 114 条评论 »

这是一个创建于 3063 天前的主题,其中的信息可能已经有所发展或是发生改变。

苏宁云盘的下载速度还是不错的,之前获取下载地址很简单。现在必须要求用户登录才能办到,难度也是增加不少。还好suning没做绝。GOOD LUCK!

提示: 回复可见网盘地址

源码

<?php
/*
    需要配置苏宁账户密码
    @author Pang 
    @url https://www.hhtjim.com
*/
error_reporting(0);
$a = new suning($_GET['id']);
$a->dl();
class suning
{
    const USER = 'XXXXXX';//苏宁账户 url编码
    const PAW = 'XXXXXXX';//苏宁密码 
    public function __construct($id)
    {
        $this->id = $id;
    }
    function tui($a)
    {
        die($a . '<br />Please Check <a href="https://www.hhtjim.com/message-wall#comment">here.');
    }
    function dl()
    {
        $header_2[] = 'User-Agent: Mozilla/5.0 (iPhone; U; CPU iPhone OS 3_0 like Mac OS X; en-us) AppleWebKit/528.18 (KHTML, like Gecko) Version/4.0 Mobile/7A341 Safari/528.16';
        $header_2[] = 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8';
        $post = 'service=https%3A%2F%2Fpan.suning.com%2Fcloud-web%2Fauth%3FtargetUrl%3Dhttp%253A%252F%252Fpan.suning.com%252Fcloud-web%252FwapLogon.htm%253Fsk%253D'.$this->id.'&username='.self::USER.'&password='.self::PAW.'&verifyCode=';
        $ticketUrl_C = $this->curl_get('https://passport.suning.com/ids/login',array('TOU'=>1,'SSL'=>1,'POST'=>$post));
        $authId_2 = $this->getSet_Cookie($ticketUrl_C ,'authId');//#52 151027 修改
        //echo $authId_2;
        $header_4[] = 'User-Agent: Mozilla/5.0 (iPhone; U; CPU iPhone OS 3_0 like Mac OS X; en-us) AppleWebKit/528.18 (KHTML, like Gecko) Version/4.0 Mobile/7A341 Safari/528.16';
        $header_4[] = 'Cookie: authId='.$authId_2;
        //$header_4[] = 'Content-Type: application/x-www-form-urlencoded; charset=UTF-8';
        $dl_json = $this->curl_get('http://pan.suning.com/cloud-web/share/downShare.htm',array('POST'=>'sk='.$this->id,'ADD_HEADER_ARRAY'=>$header_4 ));
        $o = json_decode($dl_json );
        $dl = $dl = $o->downloadURL?$o->downloadURL:$this->tui('downloadURL.');
        header('location: '.$dl,1,303);
    }
    function getLocation($concent)
    {
        preg_match('#Location: (.*)#i',$concent,$la_);
        return ($la_[1] && !emptyempty($la_[1]))?$la_[1]:false;
    }
    function getSet_Cookie($u,$name)
    {
        $a = str_replace(array(': ',';'),'&',$u);
        $a = str_replace(PHP_EOL,'&',$a);
        parse_str($a,$re);
        return  array_key_exists($name,$re)&&!emptyempty($re[$name])?$re[$name]:false;
    }
    function curl_get($url, $array=array())
    {
        $defaultOptions = array(
            'IPHONE_UA'=>1,
            'SSL'=>0,
            'TOU'=>0,
            'ADD_HEADER_ARRAY'=>0,
            'POST'=>0,
            'REFERER'=>0,
            'USERAGENT'=>0,
            'CURLOPT_FOLLOWLOCATION'=>0
        );
        $array = array_merge($defaultOptions, $array);
        $ch = curl_init($url);
        if($array['SSL']){
            curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
            curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
        }
        if ($array['IPHONE_UA'])
        {
            curl_setopt($ch, CURLOPT_HTTPHEADER, array('User-Agent: Mozilla/5.0 (iPhone; U; CPU iPhone OS 3_1_2 like Mac OS X; en-us) AppleWebKit/528.18 (KHTML, like Gecko) Version/4.0 Mobile/7D11 Safari/528.16'));
        }
        if (is_array($array['ADD_HEADER_ARRAY']))
        {
            curl_setopt($ch, CURLOPT_HTTPHEADER, $array['ADD_HEADER_ARRAY']);
        }
        if ($array['POST'])
        {
            curl_setopt($ch, CURLOPT_POSTFIELDS, $array['POST']);
        }
        if ($array['REFERER'])
        {
            curl_setopt($ch, CURLOPT_REFERER, $array['REFERER']);
        }
        if ($array['USERAGENT'])
        {
            curl_setopt($ch, CURLOPT_USERAGENT, $array['USERAGENT']);
        }
        if($array['TOU']){
            curl_setopt($ch, CURLOPT_HEADER, 1); //输出响应头
        }
        if ($array['CURLOPT_FOLLOWLOCATION'])
        {
            curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);//自动跟踪跳转的链接 
        }
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
        $get_url = curl_exec($ch);
        curl_close($ch);
        return $get_url;
    }
}

说明:
需要修改胃自己的苏宁账户和密码
调用:/su.PHP?id=XXXX
xxxx为文件id

其他文章:
本文固定链接:https://www.hhtjim.com/suning-cloud-disk-parsing-the-source-code-php.html
matrix
本文章由 matrix 于2015年10月29日发布在PHP分类下,目前没有通告,你可以至底部留下评论。
转载请注明:suning云盘解析源码[PHP]-HHTjim'S 部落格
关键字:, ,

有114 条评论 »

  1. 445 445 2018-4-25 8:07:16 +0800#88

    今年就尽快 😎

  2. 小蒋 小蒋 2018-2-2 16:20:16 +0800#87

    看看怎么样

  3. Ricky.D. Ricky.D. 2017-8-15 22:35:03 +0800#86

    呃,看看怎么样,还能用么

  4. 凯哥自媒体 凯哥自媒体 2016-12-26 9:45:55 +0800#85

    数学考满分了没

  5. appvn appvn 2016-12-23 15:45:02 +0800#84

    This is a very interesting web page and I have enjoyed reading many of the articles and posts contained on the website, keep up the good work and hope to read some more interesting content in the future. Absolutely this article is incredible.
    😛 😳

  6. 快到碗里来 快到碗里来 2016-12-15 22:27:29 +0800#83

    感谢

  7. 南尕 南尕 2016-12-11 13:37:22 +0800#82

    是啊,不知道还能用不

  8. 商学院 商学院 2016-11-29 12:06:07 +0800#81

    支持下

1 7 8 9

添加新评论 »

 🙈 😱 😂 😛 😭 😳 😀 😆 👿 😉 😯 😮 😕 😎 😐 😥 😡 😈 💡

插入图片

NOTICE: You should type some Chinese word (like “你好”) in your comment to pass the spam-check, thanks for your patience!