PHP obtains the MSN friend list

Source: Internet
Author: User

<! 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 test </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: #00 FFBE;
}
--> </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 "Communication Protocol $ proto <br/> ";
Echo "Start logon <br/> ";
# 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 "Unfortunately, the MSN server has crashed again>. <br/> ";
Die ();
} Else {
Echo "connection failed! <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 "authentication ...... <Br/> ";
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 % 2 Fmessenger % 2 Emsn % 2 Ecom, 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 "Start redirection <br/> ";
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 % 2 Fmessenger % 2 Emsn % 2 Ecom, 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 "Verification Failed! <Br/> ";
@ Fclose ($ ssl_conn );
Die ();
} Else {
If (rtrim ($ temp )! = "HTTP/1.1 200 OK "){
# Echo "Unknown HTTP status code: $ temp <br> ";
Echo "Unknown Status Code $ temp <br/> ";
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 );
&

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.