I don’t know if you are very familiar with MSXML2.XMLHTTP, but its functions can be said to be at the extreme. You can use it to "move back" other people’s websites, haha, brag!!
Today I will use it to get a QQ number avatar from Tencent website. The online situation (I can’t do it if someone is invisible). Of course, you can also get the QQ nickname, location, etc. The specific implementation method is as follows:
Create two functions first to process a URL
The code copy is as follows:
<%
functiongetHTTPPage(url)
dimhttp
setthttp=createobject("MSXML2.XMLHTTP")
Http.open"GET",url,false
Http.send()
ifHttp.readystate<>4then
exitfunction
endif
getHTTPPage=bytes2BSTR(Http.responseBody)
setthttp=nothing
iferr.number<>0thenerr.Clear
endfunction
'''''''''The following processing characters
Functionbytes2BSTR(vIn)
dimstrReturn
dimi,ThisCharCode,NextCharCode
strReturn=""
Fori=1ToLenB(vIn)
ThisCharCode=AscB(MidB(vIn,i,1))
IfThisCharCode<&H80Then
strReturn=strReturn&Chr(ThisCharCode)
Else
NextCharCode=AscB(MidB(vIn,i+1,1))
strReturn=strReturn&Chr(CLng(ThisCharCode)*&H100+CInt(NextCharCode))
i=i+1
EndIf
Next
bytes2BSTR=strReturn
EndFunction
%>
You can collect these two functions, which are of great use.
You can first check out this address http://friend.qq.com/cgi-bin/friend/oicq_find?oicq_no=5292816
(QQ is my own. I am very busy every day. Please be conscious. Haha, I am very welcome to discuss issues)
Below we will obtain information through Tencent’s friend search.
<%
functionqqhead(qq)
url="http://friend.qq.com/cgi-bin/friend/oicq_find?oicq_no="&qq
content=getHTTPPage(url)
iflen(content)>6360then'If QQ is invalid, do some processing to avoid errors.
content=replace(mid(content,instr(content,"http://img.tencent.com"),38),""","")
qqhead="<ahref='http://friend.qq.com/cgi-bin/friend/user_show_info?ln="&qq&"'target='_blank'><imgsrc='"&content&"'title='QQ:"&qq&"'border='0'></a>"
else
qqhead=""
endif
endfunction
'OK, the job is done. Now everyone just need to call it.
response.writeqqhead(5292816)
If the QQ avatar is colored, it means that the friend is online, and the gray one is not online.
%>
You can go to http://www.okwest.net/books to see the effect. Haha.