while
(!
feof
(
$this
->socket)) {
$buffer
.=
fread
(
$this
->socket,1024);
if
(preg_match("//r/n/r/n/",
$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
("/n",
$buffer
);
for
(
$i
=0;
$i
<
count
(
$split
);
$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
{