> php教程 > php手册 > PHP获取MSN好友列表

PHP获取MSN好友列表

WBOY
풀어 주다: 2016-06-13 10:37:09
원래의
1165명이 탐색했습니다.




MSN 测试







# 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 "通讯协议 $proto
";
echo "开始登录
";
# login now
$sbconn = fsockopen("messenger.hotmail.com",1863) or die("Cant 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的服务器又挂了 >.";
        die();
    } else {
        echo "连接失败!
";
        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 "身份验证中……
";
flush();

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

while ($temp != " "){
    $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 ");
fputs($ssl_conn,"Authorization: Passport1.4 OrgVerb=GET,OrgURL=http%3A%2F%2Fmessenger%2Emsn%2Ecom,sign-in=".urlencode($username).",pwd=$password,$TOKENSTRING ");
fputs($ssl_conn,"User-Agent: MSMSGS ");
fputs($ssl_conn,"Host: {$temp_array[0]} ");
fputs($ssl_conn,"Connection: Keep-Alive ");
fputs($ssl_conn,"Cache-Control: no-cache ");
$temp = fgets($ssl_conn,512);

if (rtrim($temp) == "HTTP/1.1 302 Found"){
    #echo "redirection";
    echo "开始重定向
";
    flush();
    while ($temp != " "){
        $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 ");
    fputs($ssl_conn,"Authorization: Passport1.4 OrgVerb=GET,OrgURL=http%3A%2F%2Fmessenger%2Emsn%2Ecom,sign-in=".urlencode($username).",pwd=$password,$TOKENSTRING ");
    fputs($ssl_conn,"User-Agent: MSMSGS ");
    fputs($ssl_conn,"Host: {$temp_array[2]} ");
    fputs($ssl_conn,"Connection: Keep-Alive ");
    fputs($ssl_conn,"Cache-Control: no-cache ");
} elseif (rtrim($temp)=="HTTP/1.1 401 Unauthorized"){
    #echo "invalidcreds";
    echo "验证失败!
";
    @fclose($ssl_conn);
    die();
} else {
    if (rtrim($temp) != "HTTP/1.1 200 OK"){
        #echo "Unknown HTTP status code: $temp
";
        echo "未知状态码 $temp
";
        flush();
        die();
    } else {
        #echo "set_bar_len30?";
    }
}

while ($temp != " "){
    $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);
 &

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