一个可以获取msn上用户信息的代码
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();
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 协议协商 {
$this->put(ver {$this->trid} msnp9 cvr0 rn);
$data = $this->get();
//echo $data;
if (false !== strripos($data, ver))
$this->envtalk();
}
function envtalk() // 环境协商 {
$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() // 请求确认 {
$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); // 分析服务器
list($ip, $port) = explode(:, $serv); // 分析ip和端口
$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://messenger.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(); // 重新获取登陆服务器地址
else
$this->getlogincode($this->sshlogin);
}
}
function relink($server, $port) // 重置连接 {
$this->connect = null;
$this->server = $server;
$this->port = $port;
$this->trid = 1;
$this->starttalk();
}
function relogintalk() // 重新获取服务器地址 {
$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); // 捕捉服务器登陆匹配
//print_r($out);
if (isset($out[1])) {
$this->getlogincode($out[1]);
}
else {
//return false;
exit(无法捕捉到登陆服务器的url);
}
}
function getlogincode($slogin) // 获取登陆代码 {
//echo($this->getcode);
if (!is_null($this->getcode)) {
$ch = curl_init(https:// . $slogin);
$logininfo = array(
authorization: passport1.4 rgverb=get,orgurl=http://messenger.msn.com,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);
http://www.bkjia.com/phpjc/486535.htmlwww.bkjia.comtruehttp://www.bkjia.com/phpjc/486535.htmltecharticle一个可以获取msn上用户信息的代码 ?php /* * php100中文网,整体提供,测试通过 * www.php100.com */ $msn = new mymsn(php100@2cto.com, 123); // msnv9 class mym...