一区二区久久-一区二区三区www-一区二区三区久久-一区二区三区久久精品-麻豆国产一区二区在线观看-麻豆国产视频

PHP 獲取MSN好友列表的代碼(2009-05-14測(cè)試通過(guò))

復(fù)制代碼 代碼如下:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="zh" lang="zh">
<head>
<title>MSN 測(cè)試</title>
<meta name="generator" content="Bluefish 1.0.6"/>
<meta name="keywords" content="MSN"/>
<meta name="description" content="MSN test"/>
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
<style type="text/css">
<!--
div {
font-family: arial, helvetica, sans-serif;
font-size : 13px ;
margin: 10px;
padding: 2px 10px 1px;
background-color: #C60;
color: #FFFFFF;
border-top: 1px solid #C90;
border-left: 1px solid #C90;
border-bottom: 1px solid #333;
border-right: 1px solid #333;
}
a:link {
color: #00FFBE;
}
--></style>
</head>
<body>
<div>

<?php
# filename: fm.php
# purpose: get MSN contact list
# author: http://qartis.com/?qmsn modified by Druggo

$username = $_POST['username'];
$password = $_POST['password'];
$debug = 0;
$trid = 0;
$proto = "MSNP10";

# start here
echo "通訊協(xié)議 $proto<br/>";
echo "開(kāi)始登錄<br/>";
# login now
$sbconn = fsockopen("messenger.hotmail.com",1863) or die("Can't connect to MSN server");
flush();
data_out("VER $trid $proto CVR0");
data_in();
data_out("CVR $trid 0x0409 winnt 5.1 i386 MSNMSGR 8.0.0812 MSMSGS $username");
data_in();
data_out("USR $trid TWN I $username");

$temp = data_in();

if (!stristr($temp,":")){
if (substr($temp,0,3)==601){
#echo "Error: The MSN servers are currently unavailable.";
echo "很不幸,MSN的服務(wù)器又掛了 >.<<br/>";
die();
} else {
echo "連接失敗!<br/>";
fclose($sbconn);
die();
}
}

@fclose($sbconn);
$temp_array = explode(" ",$temp);
$temp_array = explode(":",$temp_array[3]);
flush();
$sbconn = fsockopen($temp_array[0],$temp_array[1]) or die("error -_-#");
data_out("VER $trid $proto CVR0");
data_in();
flush();
data_out("CVR $trid 0x0409 winnt 5.1 i386 MSNMSGR 8.0.0812 MSMSGS $username");
data_in();
data_out("USR $trid TWN I $username");
$temp = data_in();
$temp_array = explode(" ",$temp);
flush();
$TOKENSTRING = trim(end($temp_array));
#echo "authenticating";
echo "身份驗(yàn)證中……<br/>";
flush();

$nexus_socket = fsockopen("ssl://nexus.passport.com",443);
fputs($nexus_socket,"GET /rdr/pprdr.ASP HTTP/1.0/r/n/r/n");

while ($temp != "/r/n"){
$temp = fgets($nexus_socket,1024);
if (substr($temp,0,12)=="PassportURLs"){
$urls = substr($temp,14);
}
}

$temp_array = explode(",",$urls);
$temp = $temp_array[1];
$temp = substr($temp,8);

$temp_array = explode("/",$temp);
@fclose($nexus_socket);

$ssl_conn = fsockopen("ssl://".$temp_array[0],443);
fputs($ssl_conn,"GET /{$temp_array[1]} HTTP/1.1/r/n");
fputs($ssl_conn,"Authorization: Passport1.4 OrgVerb=GET,OrgURL=http%3A%2F%2Fmessenger%2Emsn%2Ecom,sign-in=".urlencode($username).",pwd=$password,$TOKENSTRING/r/n");
fputs($ssl_conn,"User-Agent: MSMSGS/r/n");
fputs($ssl_conn,"Host: {$temp_array[0]}/r/n");
fputs($ssl_conn,"Connection: Keep-Alive/r/n");
fputs($ssl_conn,"Cache-Control: no-cache/r/n/r/n");
$temp = fgets($ssl_conn,512);

if (rtrim($temp) == "HTTP/1.1 302 Found"){
#echo "redirection";
echo "開(kāi)始重定向<br/>";
flush();
while ($temp != "/r/n"){
$temp = fgets($ssl_conn,256);
if (substr($temp,0,9)=="Location:"){
$temp_array = explode(":",$temp);
$temp_array = explode("/",trim(end($temp_array)));
break;
}
}
@fclose($ssl_conn);
$ssl_conn = fsockopen("ssl://".$temp_array[2],443);
fputs($ssl_conn,"GET /{$temp_array[3]} HTTP/1.1/r/n");
fputs($ssl_conn,"Authorization: Passport1.4 OrgVerb=GET,OrgURL=http%3A%2F%2Fmessenger%2Emsn%2Ecom,sign-in=".urlencode($username).",pwd=$password,$TOKENSTRING/r/n");
fputs($ssl_conn,"User-Agent: MSMSGS/r/n");
fputs($ssl_conn,"Host: {$temp_array[2]}/r/n");
fputs($ssl_conn,"Connection: Keep-Alive/r/n");
fputs($ssl_conn,"Cache-Control: no-cache/r/n/r/n");
} elseif (rtrim($temp)=="HTTP/1.1 401 Unauthorized"){
#echo "invalidcreds";
echo "驗(yàn)證失敗!<br/>";
@fclose($ssl_conn);
die();
} else {
if (rtrim($temp) != "HTTP/1.1 200 OK"){
#echo "Unknown HTTP status code: $temp<br>";
echo "未知狀態(tài)碼 $temp<br/>";
flush();
die();
} else {
#echo "set_bar_len30?";
}
}

while ($temp != "/r/n"){
$temp = fgets($ssl_conn,1024);
if (substr($temp,0,19)=="Authentication-Info"){
$auth_info = $temp;
$temp = fgets($ssl_conn,1024);
if (substr($temp,0,14)!="Content-Length"){
$auth_info.= fgets($ssl_conn,1024);
}
break;
}
}
@fclose($ssl_conn);

$temp_array = explode("'",$auth_info);
flush();

data_out("USR $trid TWN S {$temp_array[1]}");
flush();

$temp=data_in();

flush();
$time_since_initmsg = time();
while(!strstr($temp,"ABCHMigrated") && is_string(trim($temp))){
if (substr($temp,0,3)=="sid"){
$sid = trim(substr($temp,5));
}
if (substr($temp,0,2)=="kv"){
$kv = trim(substr($temp,4));
}
if (substr($temp,0,7)=="MSPAuth"){
$mspauth = trim(substr($temp,9));
flush();
}
$temp = data_in();
}
$temp = data_in();
#echo "authenticated<br />";
echo "驗(yàn)證通過(guò)!<br/>";
flush();

#data_out("LST 9 RL");
#data_in();

data_out("SYN $trid 0 0");
#echo "retreiving_contact_list<br />";
echo "正在獲取好友列表……<br/><br/>";
flush();
stream_set_timeout($sbconn,0,125000);

/* a lazy man doing this :D */
for($i=0;$i<160;$i++) # some say max is 150
{
$temp = data_in();
switch (substr($temp, 0, 3))
{
case "LST":
$temp_array = explode(" ",$temp);
$un = substr($temp_array[1], 2);
$nn = substr($temp_array[2], 2);
$nn1 = substr($temp_array[2], 0, 1);
if($nn1 == "F")
{
echo "<a href=/"mailto:$un/">$nn</a><br/>";
}
else
{
echo "曾經(jīng)的好友: $un<br/>";
}
#echo $temp."<br/>";
break;
default:
# no nothing
break;
}
}
echo "列表結(jié)束";
@fclose($sbconn);

# end here

# functions

function data_out($data){
global $sbconn,$debug,$trid;
fputs($sbconn,$data."/r/n");
$trid++;
if ($debug && !empty($data)){ echo "> ".$data."<br>/r/n";}
}

function data_in(){
global $sbconn,$debug;
$temp = fgets($sbconn,256);
if ($debug && !empty($temp)){echo "< ".$temp."<br>/r/n";}
return $temp;
}
?>

</div>
</body>
</html>

有需要的朋友可以參考下,大約要延遲幾秒。

php技術(shù)PHP 獲取MSN好友列表的代碼(2009-05-14測(cè)試通過(guò)),轉(zhuǎn)載需保留來(lái)源!

鄭重聲明:本文版權(quán)歸原作者所有,轉(zhuǎn)載文章僅為傳播更多信息之目的,如作者信息標(biāo)記有誤,請(qǐng)第一時(shí)間聯(lián)系我們修改或刪除,多謝。

主站蜘蛛池模板: 天天摸天天爽视频69视频 | 国产区免费 | 视色4se在线视频播放 | 亚洲精品影院 | 六月丁香婷婷网 | 亚洲欧美精品 | 久久婷婷六月 | 国产一级特黄的片子 | 美女一级毛片免费观看 | 日本一区二区三区欧美在线观看 | 久久精品亚瑟全部免费观看 | 欧美亚洲国产另类 | 国产精选91热在线观看 | www.日本高清 | 丁香婷婷在线 | 91精品国产亚一区二区三区 | 国产中文99视频在线观看 | 欧美一级特黄aaa大片 | 欧美亚洲国产精品第一页 | 最新99国产成人精品视频免费 | 国产精品九九视频 | 91插插插插插 | 极品美女一级毛片 | 久99久精品免费视频热77 | 日韩久久久精品首页 | 手机在线看片不卡中文字幕 | 亚洲婷婷综合色高清在线 | 久久精品道一区二区三区 | 99在线观看精品视频 | 久精品在线观看 | bt7086福利一区二区三区最新 | 在线播放国产视频 | 日本三级韩国三级美三级91 | 国产福利精品在线 | 国产精品久久久久久久专区 | 丁香激情综合 | 国产成人精品免费视频网页大全 | 欧美成人天天综合在线视色 | 国产美女在线看 | 久久综合九色综合欧洲色 | 日韩视频大全 |