国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > PHP > 正文

PHP獲取MSN好友列表類的實現代碼

2020-03-22 19:26:20
字體:
來源:轉載
供稿:網友
復制代碼 代碼如下:
?php
error_reporting(7);
html' target='_blank'>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("http://r/",$buffer)) {
break;
}
}
$this- checkData($buffer);
}

function getData2() {
$buffer="";
while (!feof($this- socket)) {
$buffer .= fread($this- socket,1024);
if (preg_match("http://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;
}
}

$msn = new MSN;
$msn- set_account('xx@hotmail.com', 'xxxxx');
$msn- msn_connect("messenger.hotmail.com",1863);
$data = $msn- getStatus();
print_r($data);
?
PHP教程

鄭重聲明:本文版權歸原作者所有,轉載文章僅為傳播更多信息之目的,如作者信息標記有誤,請第一時間聯系我們修改或刪除,多謝。

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 通渭县| 壶关县| 久治县| 启东市| 重庆市| 温宿县| 东台市| 越西县| 盘山县| 吉安县| 弥渡县| 陈巴尔虎旗| 安康市| 普兰县| 华池县| 手机| 灵川县| 天峨县| 竹山县| 藁城市| 和田市| 塔河县| 来凤县| 吉木乃县| 犍为县| 云林县| 商城县| 夏津县| 台前县| 额敏县| 兴海县| 鄂温| 贵溪市| 闽清县| 浦东新区| 五峰| 达日县| 六枝特区| 阿拉尔市| 吉林市| 海伦市|