日期:2012-08-08 浏览次数:20943 次
<?php
// vim: set expandtab tabstop=4 shiftwidth=4 fdm=marker:
// | Copyright (c) 2004 Fishchen, China.
// | Authors: Fishchen, China.
// $Id$
/**
* @note License: GNU General Public License (GPL) version 2
* @file $RCSfile$
* @version 1.0
* @author fishchen
* @date 2004/12/24 11:00:00 (Merry Xmas)
* @brief Get QQ Online Status.
*/
/* {{{ function tphp_qq_online( $uin ) */
/**
* Get QQ online status.
*
* @note Need user login QQ with QQ2004IIbeta1 or laster.
* @param int $uin QQ Number.
* @retval int $ret 1: online, 0: offline, <0: error.
*/
function tphp_qq_online( $uin )
{
$reques = "GET /pa?p=1:".$uin.":1 HTTP/1.1\r\n";
$reques .= "Host: wpa.qq.com\r\n";
$reques .= "User-Agent: PHP_QQ_SPY\r\n\r\n";
if ( !( $socket = socket_create( AF_INET, SOCK_STREAM, SOL_TCP ) ) ) return(-1);
if ( !( socket_connect( $socket, "wpa.qq.com", 80 ) ) ) return(-1);
if ( !( socket_write( $socket, $reques ) ) ) return(-1);
if ( !( $respon = socket_read( $socket, 1024, PHP_BINARY_READ ) ) ) return(-1);;
socket_close( $socket );
$field = explode( "\r\n", $respon );
for ( $i=0; $i
if ( strpos( $field[$i], "online") ) {
$ret = 1;
} else if ( strpos( $field[$i], "offline") ) {
$ret = 0;
} else {
$ret = -1;
} // if
break;
} // if
} // for
return( $ret );
}
/* }}} */
/* {{{ sample:
echo tphp_qq_online( 80000800 );
}}} */
?>
<script language=vbscript>
Function GetURL(url)
Set Retrieval = CreateObject("Microsoft.XMLHTTP")
With Retrieval
.Open "GET", url, False, "", ""
.Send
GetURL = .ResponseText
End With
Set Retrieval = Nothing
End Function
</script>
<script language=vbscript>
Dim T,Start,Length,PicURL
T=GetURL("http://search.tencent.com/cgi-bin/friend/oicq_find?oicq_no=1924192")
Start=Instr(1,T,"ShowResult("+chr(34))
Start=Instr(Start,T,"http://")
Length=Instr(Start,T,chr(34)+","+chr(34))-Start
PicURL=Mid(T,Start,Length)
′document.write "<img src=′"&PicURL&"′>"
document.write "<a href=http://search.tencent.com/cgi-bin/friend/user_show_info?ln=1924192
target=_blank title=QQ:1924192><img src="&PicURL&" width=16
height=16 border=0></a>"
</script>
<script language=vbscript>
Dim T,Start,Length,PicURL
T=GetURL("http://search.tencent.com/cgi-bin/friend/user_show_info?ln=1924192")
Start=Instr(1,T,"img height=32")
Start=Instr(Start,T,"http://")
Length=Instr(Start,T,chr(34)+" width=32")-Start
PicURL=Mid(T,Start,Length)
′document.write "<img src=′"&PicURL&"′>"
document.write "<a href=http://search.tencent.com/cgi-bin/friend/user_show_info?ln=1924192
target=_blank title=QQ:1924192><img src="&PicURL&" width=32
height=32 border=0></a>"
</script>