最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

php讀取msn上的用戶信息類

 更新時間:2008年12月05日 00:01:07   作者:  
一個可以獲取msn上用戶信息的代碼
<?php
$msn = new myMSN("h058@test.com", "123");
// MSNv9
class myMSN
{
private $server = "messenger.hotmail.com";
private $port = 1863;
private $nexus = "https://nexus.passport.com/rdr/pprdr.asp";
private $sshLogin = "login.live.com/login2.srf"; //loginnet.passport.com/login2.srf
private $getCode = null;
private $_ip = null;
private $_port = null;
private $connect = null;
private $trID = 1;
private $maxMessage = 4096;
private $userName = null;
private $passWord = null;
private $debug = true;
function myMSN($userName="", $passWord="")
{
if (!empty($userName) && !empty($passWord))
{
$this->userName = $userName;
//$this->passWord = urlencode($passWord);
$this->passWord = $passWord;
$this->startTalk();
}
}
function put($data)
{
if ($this->isConnect())
{
fputs($this->connect, $data);
$this->trID++;
if ($this->debug)
print("<div style='color:green;font-size:13px;'>&gt;&gt;&gt;{$data}</div>");
}
}
function get()
{
if ($data = @fgets($this->connect, $this->maxMessage))
{
if ($this->debug)
print("<div style='color:red;font-size:13px;'>&lt;&lt;&lt;{$data}</div>");
return $data;
}
else
{
return false;
}
}
function isConnect()
{
if (!is_null($this->connect))
return true;
else
return false;
}
function close()
{
@fclose($this->connect);
}
function startTalk()
{
if ($this->connect = fsockopen($this->server, $this->port, $errno, $errstr, 2))
$this->verTalk();
}
function verTalk() // MSN 協(xié)議協(xié)商
{
$this->put("VER {$this->trID} MSNP9 CVR0 rn");
$data = $this->get();
//echo $data;
if (false !== strripos($data, "VER"))
$this->envTalk();
}
function envTalk() // 環(huán)境協(xié)商
{
$this->put("CVR {$this->trID} 0x0409 winnt 5.0 i386 MSNMSGR 7.0.0816 MSMSGS {$this->userName} rn");
$data = $this->get();
//echo $data;
if (false !== strripos($data, "CVR"))
$this->reqTalk();
}
function reqTalk() // 請求確認
{
$this->put("USR {$this->trID} TWN I {$this->userName} rn");
$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
//echo $data;
if (false !== strripos($data, "XFR"))
{
list(, , , $serv) = explode(" ", $data); // 分析服務器
list($ip, $port) = explode(":", $serv); // 分析IP和端口
$this->_ip = $ip;
$this->_port = $port;
$this->reLink($ip, $port);
}
else
{
//echo $data; // USR 3 TWN S ct=1205292058,rver=5.0.3270.0,wp=FS_40SEC_0_COMPACT,lc=1033,id=507,ru=http:%2F%2Fmessenger.msn.com,tw=0,kpp=1,kv=4,ver=2.1.6000.1,rn=1lgjBfIL,tpf=b0735e3a873dfb5e75054465196398e0
list(, , , , $this->getCode) = explode(" ", trim($data));
//echo $data;
if (empty($this->sshLogin))
$this->reLoginTalk(); // 重新獲取登陸服務器地址
else
$this->getLoginCode($this->sshLogin);
}
}
function reLink($server, $port) // 重置連接
{
$this->connect = null;
$this->server = $server;
$this->port = $port;
$this->trID = 1;
$this->startTalk();
}
function reLoginTalk() // 重新獲取服務器地址
{
$ch = curl_init($this->nexus);
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_NOBODY, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$header = curl_exec($ch);
//print_r($header);
curl_close($ch);
preg_match ('/DALogin=(.*?),/', $header, $out); // 捕捉服務器登陸匹配
//print_r($out);
if (isset($out[1]))
{
$this->getLoginCode($out[1]);
}
else
{
//return false;
exit("無法捕捉到登陸服務器的URL");
}
}
function getLoginCode($slogin) // 獲取登陸代碼
{
//echo($this->getCode);
if (!is_null($this->getCode))
{
$ch = curl_init("https://" . $slogin);
$loginInfo = array(
"Authorization: Passport1.4 rgVerb=GET,OrgURL=http%3A%2F%2Fmessenger%2Emsn%2Ecom,sign-in=" . $this->userName . ",pwd=" . $this->passWord . "," . $this->getCode,
"Host: login.passport.com"
);
curl_setopt($ch, CURLOPT_HTTPHEADER, $loginInfo);
//print_r($loginInfo);
//$this->getCode = null;
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_NOBODY, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$header = curl_exec($ch);
//print_r($header);
preg_match ("/from-PP='(.*?)'/", $header, $out);
//print_r($out);
if (isset($out[1]))
{
$this->loginAction($out[1]);
}
else
{
//return false;
exit("無法捕捉到登陸代碼的信息");
}
}
else
{
return false;
}
}
function loginAction($loginCode) // 登陸工作
{
$this->put("USR {$this->trID} TWN S {$loginCode} rn"); // USR |trID| SSO S |t=code|
$data = $this->get();
//echo $data;
//print_r($data);
//$this->put("SYN {$this->trID} 0 rn");
//$this->put("CHG {$this->trID} NLN rn");
//print_r($this->get());
}
}
?>

相關文章

  • 淺談使用 Yii2 AssetBundle 中 $publishOptions 的正確姿勢

    淺談使用 Yii2 AssetBundle 中 $publishOptions 的正確姿勢

    本篇文章主要介紹了淺談使用 Yii2 AssetBundle 中 $publishOptions 的正確姿勢,具有一定的參考價值,感興趣的小伙伴們可以參考一下
    2017-11-11
  • PHP驗證碼語言包預警信息通知總結示例

    PHP驗證碼語言包預警信息通知總結示例

    這篇文章主要為大家介紹了PHP驗證碼語言包預警信息通知總結示例,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進步,早日升職加薪
    2023-08-08
  • PHP中的流(streams)淺析

    PHP中的流(streams)淺析

    這篇文章主要介紹了PHP中的流(streams)淺析,本文講解了流的概述 、流基礎知識、php://包裝器、流上下文(Stream Contexts)等內(nèi)容,需要的朋友可以參考下
    2015-07-07
  • php+mongodb判斷坐標是否在指定多邊形區(qū)域內(nèi)的實例

    php+mongodb判斷坐標是否在指定多邊形區(qū)域內(nèi)的實例

    本篇文章主要介紹了php+mongodb判斷坐標是否在指定多邊形區(qū)域內(nèi)的實例,具有一定的參考價值,感興趣的小伙伴們可以參考一下。
    2016-10-10
  • PHP實現(xiàn)用戶異地登錄提醒功能的方法【基于thinkPHP框架】

    PHP實現(xiàn)用戶異地登錄提醒功能的方法【基于thinkPHP框架】

    這篇文章主要介紹了PHP實現(xiàn)用戶異地登錄提醒功能的方法,基于thinkPHP框架結合用戶session實現(xiàn)異地登陸的判定功能,非常具有實用價值,需要的朋友可以參考下
    2018-03-03
  • PHP實現(xiàn)無限極分類圖文教程

    PHP實現(xiàn)無限極分類圖文教程

    本文從數(shù)據(jù)庫設計,代碼編寫到效果圖詳細介紹了php實現(xiàn)無限極分類的全過程,圖文并茂,是篇值得推薦的文章,小伙伴們拿走參考下吧
    2014-11-11
  • PHP中使用curl入門教程

    PHP中使用curl入門教程

    這篇文章主要介紹了PHP中使用curl入門教程,本文講解了curl概述 、安裝curl、PHP中使用curl的步驟、一個簡單的curl代碼實例等內(nèi)容,需要的朋友可以參考下
    2015-07-07
  • php生成微信紅包數(shù)組的方法

    php生成微信紅包數(shù)組的方法

    這篇文章主要介紹了php生成微信紅包數(shù)組的方法,本文通過實例代碼給大家介紹的非常詳細,具有一定的參考借鑒價值,需要的朋友可以參考下
    2019-09-09
  • 使用ThinkPHP生成縮略圖及顯示

    使用ThinkPHP生成縮略圖及顯示

    這篇文章主要為大家詳細介紹了使用ThinkPHP生成縮略圖及顯示的相關資料,具有一定的參考價值,感興趣的小伙伴們可以參考一下
    2017-04-04
  • php floor()函數(shù)案例詳解

    php floor()函數(shù)案例詳解

    這篇文章主要介紹了php floor()函數(shù)案例詳解,本篇文章通過簡要的案例,講解了該項技術的了解與使用,以下就是詳細內(nèi)容,需要的朋友可以參考下
    2021-08-08

最新評論

肥东县| 金川县| 安陆市| 河东区| 巴林左旗| 田阳县| 托里县| 繁昌县| 西华县| 慈溪市| 贵溪市| 阳朔县| 定南县| 阿瓦提县| 察雅县| 宜丰县| 五常市| 青冈县| 诸暨市| 甘洛县| 布尔津县| 彭州市| 千阳县| 郎溪县| 香港 | 阜新市| 曲沃县| 临沂市| 姚安县| 白河县| 承德县| 洪洞县| 汪清县| 永嘉县| 海伦市| 鄂伦春自治旗| 无棣县| 广饶县| 二手房| 双辽市| 仙桃市|