喜悦国际村 » PHP高级编程 » PHP实现WEB登陆MSN获取好友列表

页: [1] 2
士为心志2008-6-17 06:25 AM
PHP实现WEB登陆MSN获取好友列表

PHP实现WEB登陆MSN获取好友列表   有没有哪位仁兄提供一下代码!

sadly2008-6-17 06:29 AM
google :
msn   contact  grabber

士为心志2008-6-17 06:50 AM
感谢村长大人!

奶瓶2008-6-17 07:22 AM
12以下的协议非常不稳定
尤其是对好友和分组多的账号
能成功fetch完列表的几率不到20%

imjl2008-6-17 08:21 AM
最近好像msn骚扰又出现了。


上次我测试了100个msn登录用了25秒, 改天反攻这帮鸟人。

[[i] 本帖最后由 imjl 于 2008-6-17 04:23 PM 编辑 [/i]]

士为心志2008-6-17 08:39 AM
[quote]原帖由 [i]奶瓶[/i] 于 2008-6-17 03:22 PM 发表
12以下的协议非常不稳定
尤其是对好友和分组多的账号
能成功fetch完列表的几率不到20% [/quote]

奶瓶有新的吗?挂上来啊

xieaotian2008-6-18 04:13 AM
是什么原理呀,我见过有人用comet做过web msn的,速度比软件版的要快3倍速.

奶瓶2008-6-18 05:13 AM
用MSN15的API
不过那玩意很诡异
就是live的协议

它有一个好处,不像12以前的那样,会把当前在线的MSN踢掉

qibinghua2008-6-18 04:33 PM
用C#写几好啊,我有C#的代码。
[url]http://www.hypothetic.org/docs/msn/resources/projects.php[/url]
上面的地址你能找到很多PHP的代码

xieaotian2008-6-19 12:24 AM
[quote]原帖由 [i]qibinghua[/i] 于 2008-6-19 12:33 AM 发表
用C#写几好啊,我有C#的代码。
[url]http://www.hypothetic.org/docs/msn/resources/projects.php[/url]
上面的地址你能找到很多PHP的代码 [/quote]
牛X,非常好。不过只有代码还不行,服务器优化方面要求似乎也很高。

stefenjun2008-6-19 07:29 AM
有人写过获取QQ的好友没

奶瓶2008-6-19 08:15 AM
开心网

fly5122008-6-19 08:54 AM
[php]
class msn
{
        private $startcomm = 0;
        private $username = '';
        private $password = '';
        private $commend = '';
        private $domain = '';
        private $socket = '';
        private $challenge = '';
        private $status = array();
        private $data = array();
       
        function set_account($username, $password)
        {
                $this->username = $username;
                $this->password = $password;
        }

        function getData(){
                $buffer="";
                while (!feof($this->socket)) {
                        $buffer .= fread($this->socket,1024);
                        if (preg_match("/\r/",$buffer)) {
                                break;
                        }
                }
                $this->checkData($buffer);
        }

        function getData2() {
                $buffer="";
                while (!feof($this->socket)) {
                        $buffer .= fread($this->socket,1024);
                        if (preg_match("/\r\n\r\n/",$buffer)) {
                                break;
                        }
                }
                $this->checkData($buffer);
        }

        function checkData($buffer) {
                if (preg_match("/lc\=(.+?)/Ui",$buffer,$matches)) {   
                        $this->challenge = "lc=" . $matches[1];
                }

                if (preg_match("/(XFR 3 NS )([0-9\.\:]+?) (.*) ([0-9\.\:]+?)/is",$buffer,$matches)) {
                        $split = explode(":",$matches[2]);
                        $this->startcomm = 1;
                        $this->msn_connect($split[0],$split[1]);
                }

                if (preg_match("/tpf\=([a-zA-Z0-9]+?)/Ui",$buffer,$matches)) {
                        $this->nexus_connect($matches[1]);
                }

                $split = explode("\n",$buffer);
                for ($i=0;$i<count($split);$i++) {  
                        $detail = explode(" ",$split[$i]);
                        if ($detail[0] == "LST") {
                                if(isset($detail[2])) $this->data[] = array($detail[1], urldecode($detail[2]));
                        }
                }
                $this->status = array(200, $this->data);
                //echo $buffer;
        }

        function msn_connect($server,$port) {
                if ($this->socket) {
                        fclose($this->socket);
                }
                $this->socket = @fsockopen($server,$port, $errno, $errstr, 20);
                if (!$this->socket) {
                        $this->status = array(500,'MSN验证服务器无法连接');
                        return false;
                } else {
                        $this->startcomm++;
                        $this->send_command("VER " . $this->startcomm . " MSNP8 CVR0",1);
                        $this->send_command("CVR " . $this->startcomm . " 0x0409 win 4.10 i386 MSNMSGR 6.2 MSMSGS " . $this->username,1);
                        $this->send_command("USR " . $this->startcomm . " TWN I " . $this->username,1);
                }
        }

        function send_command($command) {
                $this->commend = $command;
                $this->startcomm++;      
                fwrite($this->socket,$command . "\r\n");
                $this->getData();
        }

        function nexus_connect($tpf) {
                $arr[] = "GET /rdr/pprdr.asp HTTP/1.0\r\n\r\n";
                $curl = curl_init();
            curl_setopt($curl, CURLOPT_URL, "https://nexus.passport.com:443/rdr/pprdr.asp");
                curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
                curl_setopt($curl, CURLOPT_VERBOSE, 0);
                curl_setopt($curl, CURLOPT_HEADER,1);
                curl_setopt($curl, CURLOPT_HTTPHEADER, $arr);
                curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, FALSE);
                $data = curl_exec($curl);
                curl_close($curl);
                preg_match("/DALogin=(.+?),/",$data,$matches);
                if(!isset($matches[1])) return false;
                $split = explode("/",$matches[1]);
                $headers[0] = "GET /$split[1] HTTP/1.1\r\n";
                $headers[1] = "Authorization: Passport1.4 OrgVerb=GET,OrgURL=http%3A%2F%2Fmessenger%2Emsn%2Ecom,sign-in=" . $this->username . ",pwd=" . $this->password . ", " . trim($this->challenge) . "\r\n";
                $curl = curl_init();
                curl_setopt($curl, CURLOPT_URL, "https://" . $split[0] . ":443/". $split[1]);
                curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
                curl_setopt($curl, CURLOPT_VERBOSE, 0);
                curl_setopt($curl,CURLOPT_FOLLOWLOCATION,1);
                curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
                curl_setopt($curl, CURLOPT_HEADER,1);
                curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, FALSE);
                $data = curl_exec($curl);
                curl_close($curl);
                preg_match("/t=(.+?)'/",$data,$matches);
                if(!isset($matches[1])){
                        $this->status = array(404, '你输入的MSN帐号或者密码错误');
                        return false;
                }
                $this->send_command("USR " . $this->startcomm . " TWN S t=" . trim($matches[1]) . "",2);
                $this->send_command("CHG " . $this->startcomm . " HDN",2);
                $this->send_command("SYN " . $this->startcomm . " 0",2);
                $this->getData2();
                $this->send_command("SYN " . $this->startcomm . " 1 46 2",2);
                $this->getData2();
                $this->send_command("CHG ". $this->startcomm . " BSY");
                $this->getData();     
        }

        public function getStatus()
        {
                return $this->status;
        }
}

[/php]

fly5122008-6-19 08:56 AM
[php]
                $msn = new MSN;
                $msn->set_account($msn_name, $msn_password);
                $msn->msn_connect("messenger.hotmail.com",1863);
                $data = $msn->getStatus();
[/php]

奶瓶2008-6-19 10:27 AM
MSNP8

xieaotian2008-6-19 11:41 PM
[quote]原帖由 [i]fly512[/i] 于 2008-6-19 04:56 PM 发表

                $msn = new MSN;
                $msn->set_account($msn_name, $msn_password);
                $msn->msn_connect("messenger.hotmail.com",1863);
                $data = $msn->getStatus();
[/quote]
你的代码测试过吗,不行,错误一大堆~

奶瓶2008-6-20 05:51 AM
我用过啊

xieaotian2008-6-20 11:50 PM
用过就再试试,我试了不行

phpxxx2008-6-21 02:26 PM
try msnbot base of msnlib

fly5122008-6-23 09:32 AM
[quote]原帖由 [i]xieaotian[/i] 于 2008-6-20 07:41 AM 发表

你的代码测试过吗,不行,错误一大堆~ [/quote]


把我的 换行(\  r \ n)给吃了


查看完整版本: PHP实现WEB登陆MSN获取好友列表


Powered by Discuz! Archiver 6.1.0  © 2001-2006 Comsenz Inc.
Processed in 0.099541 second(s), 2 queries