<?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>
新闻热点
疑难解答