PHP reads the user information class on MSN

Source: Internet
Author: User
Tags explode header connect

A code that can get user information on MSN

<?php
$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 ("<div style= ' color:green;font-size:13px; ') >>>>{$data}</div> ");
}
}
function Get () {
if ($data = @fgets ($this->connect, $this->maxmessage)) {
if ($this->debug)
Print ("<div style= ' color:red;font-size:13px; ') ><<<{$data}</div> ");
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 Acknowledgement {
$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); Analyzing IP 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=1lgjbfil,tpf=b0735e3a873dfb5e75054465196398e0
List (,,,, $this->getcode) = Explode ("", Trim ($data));
Echo $data;
if (Empty ($this->sshlogin))
$this->relogintalk (); Re-obtain Login server address
Else
$this->getlogincode ($this->sshlogin);
}
}
function relink ($server, $port)//Reset Connection {
$this->connect = null;
$this->server = $server;
$this->port = $port;
$this->trid = 1;
$this->starttalk ();
}
function Relogintalk ()//re-obtain server address {
$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 Match
Print_r ($out);
if (Isset ($out [1])) {
$this->getlogincode ($out [1]);
}
else {
return false;
Exit ("Unable to capture URL of login server");
}
}
function Getlogincode ($slogin)//Get 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%2fmessenger%2emsn%2ecom,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 the information of the login Code");
}
} 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 ());
}
}
?>

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.