> 백엔드 개발 > PHP 튜토리얼 > PHP模拟登陆MSN并获得用户信息_PHP教程

PHP模拟登陆MSN并获得用户信息_PHP教程

WBOY
풀어 주다: 2016-07-13 17:37:56
원래의
1156명이 탐색했습니다.

一个可以获取msn上用户信息的代码

<font face="NSimsun"><?php </font></font>
/*
* bkJia中文网,整体提供,测试通过
* www.bkJia.com
*/<font face="NSimsun"><br> $msn = new myMSN(php100@2cto.com, "123");<br> // MSNv9<br> class myMSN {<br> private $server = "messenger.hotmail.com";<br> private $port = 1863;<br> private $nexus = "https://nexus.passport.com/rdr/pprdr.asp";<br> private $sshLogin = "login.live.com/login2.srf"; //loginnet.passport.com/login2.srf<br> private $getCode = null;<br> private $_ip = null;<br> private $_port = null;<br> private $connect = null;<br> private $trID = 1;<br> private $maxMessage = 4096;<br> private $userName = null;<br> private $passWord = null;<br> private $debug = true;<br> function myMSN($userName="", $passWord="") {<br> if (!empty($userName) && !empty($passWord)) {<br> $this->userName = $userName;<br> //$this->passWord = urlencode($passWord);<br> $this->passWord = $passWord;<br> $this->startTalk();<br> }<br> }<br> function put($data) {<br> if ($this->isConnect()) {<br> fputs($this->connect, $data);<br> $this->trID ;<br> if ($this->debug)<br> print("<div style="color:green;font-size:13px;">>>>{$data}</div>");<br> }<br> }<br> function get() {<br> if ($data = @fgets($this->connect, $this->maxMessage)) {<br> if ($this->debug)<br> print("<div style="color:red;font-size:13px;">");<br> return $data;<br> } else {<br> return false;<br> }<br> }<br> function isConnect() {<br> if (!is_null($this->connect))<br> return true;<br> else<br> return false;<br> }<br> function close() {<br> @fclose($this->connect);<br> }<br> function startTalk() {<br> if ($this->connect = fsockopen($this->server, $this->port, $errno, $errstr, 2))<br> $this->verTalk();<br> }<br> function verTalk() // MSN 协议协商 {<br> $this->put("VER {$this->trID} MSNP9 CVR0 rn");<br> $data = $this->get();<br> //echo $data;<br> if (false !== strripos($data, "VER"))<br> $this->envTalk();<br> }<br> function envTalk() // 环境协商 {<br> $this->put("CVR {$this->trID} 0x0409 winnt 5.0 i386 MSNMSGR 7.0.0816 MSMSGS {$this->userName} rn");<br> $data = $this->get();<br> //echo $data;<br> if (false !== strripos($data, "CVR"))<br> $this->reqTalk();<br> }<br> function reqTalk() // 请求确认 {<br> $this->put("USR {$this->trID} TWN I {$this->userName} rn");<br> $data = $this->get(); // XFR 3 NS 207.46.107.41:1863 0 65.54.239.210:1863 XFR 3 NS 207.46.107.25:1863 U D<br> //echo $data;<br> if (false !== strripos($data, "XFR")) {<br> list(, , , $serv) = explode(" ", $data); // 分析服务器<br> list($ip, $port) = explode(":", $serv); // 分析IP和端口<br> $this->_ip = $ip;<br> $this->_port = $port;<br> $this->reLink($ip, $port);<br> } else {<br> //echo $data; // USR 3 TWN S ct=1205292058,rver=5.0.3270.0,wp=FS_40SEC_0_COMPACT,lc=1033,id=507,ru=http://messenger.msn.com,tw=0,kpp=1,kv=4,ver=2.1.6000.1,rn=1lgjBfIL,tpf=b0735e3a873dfb5e75054465196398e0<br> list(, , , , $this->getCode) = explode(" ", trim($data));<br> //echo $data;<br> if (empty($this->sshLogin))<br> $this->reLoginTalk(); // 重新获取登陆服务器地址<br> else<br> $this->getLoginCode($this->sshLogin);<br> }<br> }<br> function reLink($server, $port) // 重置连接 {<br> $this->connect = null;<br> $this->server = $server;<br> $this->port = $port;<br> $this->trID = 1;<br> $this->startTalk();<br> }<br> function reLoginTalk() // 重新获取服务器地址 {<br> $ch = curl_init($this->nexus);<br> curl_setopt($ch, CURLOPT_HEADER, 1);<br> curl_setopt($ch, CURLOPT_NOBODY, 1);<br> curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);<br> curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);<br> curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);<br> $header = curl_exec($ch);<br> //print_r($header);<br> curl_close($ch);<br> preg_match (/DALogin=(.*?),/, $header, $out); // 捕捉服务器登陆匹配<br> //print_r($out);<br> if (isset($out[1])) {<br> $this->getLoginCode($out[1]);<br> }<br> else {<br> //return false;<br> exit("无法捕捉到登陆服务器的URL");<br> }<br> }<br> function getLoginCode($slogin) // 获取登陆代码 {<br> //echo($this->getCode);<br> if (!is_null($this->getCode)) {<br> $ch = curl_init("https://" . $slogin);<br> $loginInfo = array(<br> "Authorization: Passport1.4 rgVerb=GET,OrgURL=http://messenger.msn.com,sign-in=" . $this->userName . ",pwd=" . $this->passWord . "," . $this->getCode,<br> "Host: login.passport.com"<br> );<br> curl_setopt($ch, CURLOPT_HTTPHEADER, $loginInfo);<br> //print_r($loginInfo);<br> //$this->getCode = null;<br> curl_setopt($ch, CURLOPT_HEADER, 1);<br> curl_setopt($ch, CURLOPT_NOBODY, 1);<br> curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);<br> curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);<br> curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); <p align="left"></p> <div style="display:none;"> <span id="url" itemprop="url">http://www.bkjia.com/PHPjc/486535.html</span><span id="indexUrl" itemprop="indexUrl">www.bkjia.com</span><span id="isOriginal" itemprop="isOriginal">true</span><span id="isBasedOnUrl" itemprop="isBasedOnUrl">http://www.bkjia.com/PHPjc/486535.html</span><span id="genre" itemprop="genre">TechArticle</span><span id="description" itemprop="description">一个可以获取msn上用户信息的代码 ?php /* * PHP100中文网,整体提供,测试通过 * www.PHP100.com */ $msn = new myMSN(php100@2cto.com, 123); // MSNv9 class myM...</span> </div> </div> <div class="art_confoot"></div> </font>

원천:php.cn
본 웹사이트의 성명
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.
인기 튜토리얼
더>
최신 다운로드
더>
웹 효과
웹사이트 소스 코드
웹사이트 자료
프론트엔드 템플릿