php实现邀请好友,新版php获取MSN好友列表,邀请MSN好友_PHP教程

error_reporting(7);

class msn

{

private $startcomm = 0;

private $username = ;

private $password = ;

private $commend = ;

private $domain = ;

private $socket = ;

private $challenge = ;

private $status = array();

private $data = array();

function set_account($username, $password)

{

$this->username = $username;

$this->password = $password;

}

function getData(){

$buffer=””;

while (!feof($this->socket)) {

$buffer .= fread($this->socket,1024);

if (preg_match(“//”,$buffer)) {

break;

}

}

$this->checkData($buffer);

}

function getData2() {

$buffer=””;

while (!feof($this->socket)) {

$buffer .= fread($this->socket,1024);

if (preg_match(“/

/”,$buffer)) {

break;

}

}

$this->checkData($buffer);

}

function checkData($buffer) {

if (preg_match(“/lc=(.+?)/Ui”,$buffer,$matches)) {

$this->challenge = “lc=” . $matches[1];

}

if (preg_match(“/(XFR 3 NS )([0-9.:]+?) (.*) ([0-9.:]+?)/is”,$buffer,$matches)) {

$split = explode(“:”,$matches[2]);

$this->startcomm = 1;

$this->msn_connect($split[0],$split[1]);

}

if (preg_match(“/tpf=([a-zA-Z0-9]+?)/Ui”,$buffer,$matches)) {

$this->nexus_connect($matches[1]);

}

$split = explode(”

“,$buffer);

for ($i=0;$i

$detail = explode(” “,$split[$i]);

if ($detail[0] == “LST”) {

if(isset($detail[2])) $this->data[] = array($detail[1], urldecode($detail[2]));

}

}

$this->status = array(200, $this->data);

//echo $buffer;

}

function msn_connect($server,$port) {

if ($this->socket) {

fclose($this->socket);

}

$this->socket = @fsockopen($server,$port, $errno, $errstr, 20);

if (!$this->socket) {

$this->status = array(500,MSN验证服务器无法连接);

return false;

} else {

$this->startcomm++;

$this->send_command(“VER ” . $this->startcomm . ” MSNP8 CVR0″,1);

$this->send_command(“CVR ” . $this->startcomm . ” 0x0409 win 4.10 i386 MSNMSGR 6.2 MSMSGS ” . $this->username,1);

$this->send_command(“USR ” . $this->startcomm . ” TWN I ” . $this->username,1);

}

}

function send_command($command) {

$this->commend = $command;

$this->startcomm++;

fwrite($this->socket,$command . ”

“);

$this->getData();

}

function nexus_connect($tpf) {

$arr[] = “GET /rdr/pprdr.asp HTTP/1.0

“;

$curl = curl_init();

curl_setopt($curl, CURLOPT_URL, “https://nexus.passport.com:443/rdr/pprdr.asp”);

curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);

curl_setopt($curl, CURLOPT_VERBOSE, 0);

curl_setopt($curl, CURLOPT_HEADER,1);

curl_setopt($curl, CURLOPT_HTTPHEADER, $arr);

curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, FALSE);

$data = curl_exec($curl);

curl_close($c

www.bkjia.comtrueTechArticle?php error_reporting(7); class msn { private $startcomm = 0; private $username = ; private $password = ; private $commend = ; private $domain = ; private $socket = ; private $chall…

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值