欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

通過MSXML2自動(dòng)獲取QQ個(gè)人頭像及在線情況(給初學(xué)者)

 更新時(shí)間:2007年03月05日 00:00:00   作者:  
不知道大家對(duì)MSXML2.XMLHTTP是不是很熟悉,不過它的功能可以說是達(dá)到了極點(diǎn).你可以通過它把別人的網(wǎng)站都"搬回來",呵呵,吹牛啦!!
今天我就用它從騰訊網(wǎng)站獲取一個(gè)QQ號(hào)碼的頭像,在線情況(人家隱身了我也沒辦法).當(dāng)然大家也可以獲取QQ的昵稱,所在地等.具體實(shí)現(xiàn)方法如下:
先建立兩個(gè)函數(shù),用來處理一個(gè)URL
復(fù)制代碼 代碼如下:

<% 
function getHTTPPage(url) 
dim http 
set http=createobject("MSXML2.XMLHTTP") 
Http.open "GET",url,false 
Http.send() 
if Http.readystate<>4 then  
exit function 
end if 
getHTTPPage=bytes2BSTR(Http.responseBody) 
set http=nothing 
if err.number<>0 then err.Clear  
end function 
'''''''以下處理字符 
Function bytes2BSTR(vIn) 
dim strReturn 
dim i,ThisCharCode,NextCharCode 
strReturn = "" 
For i = 1 To LenB(vIn) 
ThisCharCode = AscB(MidB(vIn,i,1)) 
If ThisCharCode < &H80 Then 
strReturn = strReturn & Chr(ThisCharCode) 
Else 
NextCharCode = AscB(MidB(vIn,i+1,1)) 
strReturn = strReturn & Chr(CLng(ThisCharCode) * &H100 + CInt(NextCharCode)) 
i = i + 1 
End If 
Next 
bytes2BSTR = strReturn 
End Function 
%> 
這兩個(gè)函數(shù)你可以收藏起來,用處大得不得了.
大家可以先看看這個(gè)地址http://friend.qq.com/cgi-bin/friend/oicq_find?oicq_no=5292816
(QQ是本人的,我每天都很忙,請(qǐng)大家自覺,呵呵,討論問題非常歡迎)
以下我們就通過騰訊的好友查找來獲取信息,
<%
function qqhead(qq)
url="http://friend.qq.com/cgi-bin/friend/oicq_find?oicq_no="&qq
content=getHTTPPage(url)
if len(content)>6360 then '如果QQ無效,做一些處理,避免錯(cuò)誤發(fā)生.
content=replace(mid(content,instr(content,"http://img.tencent.com"),38),"""","")
qqhead="<a 
else
qqhead=""
end if
end function
'OK了,大功告成了.現(xiàn)在大家只要調(diào)用就行了.
response.write qqhead(5292816)
如果QQ頭像是彩色的,說明好友在線,灰的就是不在線.
%>

大家可以到http://www.okwest.net/books看看效果.呵呵.

相關(guān)文章

最新評(píng)論