A code that can obtain user information on msn & lt ;? Php $ msnnewmyMSN (h058@test.com, 123); MSNv9classmyMSN {PRivate $ servermessenger.hotmail.com; private $ port1863; private $ nexus a code that can get user information on msn
$ 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 ("
>>>{ $ Data}
");
}
}
Function get (){
If ($ data = @ fgets ($ this-> connect, $ this-> maxMessage )){
If ($ this-> debug)
Print ("
<{$ Data}
");
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 protocol negotiation {
$ This-> put ("VER {$ this-> trID} MSNP9 CVR0 rn ");
$ Data = $ this-> get ();
// Echo $ data;
If (false! = Strripos ($ data, "VER "))
$ This-> envTalk ();
}
Function envTalk () // environment negotiation {
$ 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 () // request confirmation {
$ 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); // analysis server
List ($ ip, $ port) = explode (":", $ serv); // analyze IP addresses and ports
$ 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 = 1 lgjBfIL, tpf = b0735e3a873dfb5e75054213196398e0
List (, $ this-> getCode) = explode ("", trim ($ data ));
// Echo $ data;
If (empty ($ this-> sshLogin ))
$ This-> reLoginTalk (); // Obtain the logon server address again.
Else
$ This-> getLoginCode ($ this-> sshLogin );
}
}
Function reLink ($ server, $ port) // reset the connection {
$ This-> connect = null;
$ This-> server = $ server;
$ This-> port = $ port;
$ This-> trID = 1;
$ This-> startTalk ();
}
Function reLoginTalk () // Obtain the server address again {
$ 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); // capture server login matching
// Print_r ($ out );
If (isset ($ out [1]) {
$ This-> getLoginCode ($ out [1]);
}
Else {
// Return false;
Exit ("unable to capture the URL of the login server ");
}
}
Function getLoginCode ($ slogin) // Obtain the login code {
// Echo ($ this-> getCode );
If (! Is_null ($ this-> getCode )){
$ Ch = curl_init ("https: //". $ slogin );
$ LoginInfo = array (
"Authorization: Passport1.4 rgVerb = GET, OrgURL = http % 3A % 2F % 2 Fmessenger % 2 Emsn % 2 Ecom, 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 ("unable to capture login code information ");
}
} Else {
Return false;
}
}
Function loginAction ($ loginCode) // login work {
$ 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 ());
}
}
?>