Automatically obtain QQ personal avatar and online situation by MSXML2 (for beginners)

zhaozj2021-02-16  53

I don't know if everyone is very familiar with MSXML2.xmlhttp, but its function can be said to have a pole. You can "move back" by it through it, huh, braggy!!

Today, I use it from Tencent website to get a QQ number of the avatar. Online situation (there is no way to hide me). Of course, everyone can get QQ nicknames, the location, etc. The specific implementation method is as follows:

First establish two functions, used to process a URL

<%

Function gethttppage (URL)

DIM HTTP

Set http = creteObject ("msxml2.xmlhttp")

Http.open "Get", URL, FALSE

Http.send ()

IF http.readystate <> 4 THEN

EXIT FUNCTION

END IF

geternal = BYTES2BSTR (http.responsebody)

Set http = Nothing

if Err.Number <> 0 Then Err.Clear

END FUNCTION

'' '' '' 'Below processing characters

Function Bytes2bstr (VIN)

DIM STRRETURN

Dim I, thischarcode, Nextcharcode, 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 (thischarcode) * & H100 cint (nextcharcode))

i = i 1

END IF

NEXT

BYTES2BSTR = STRRETURN

END FUNCTION

%>

These two functions you can collect and use it everywhere.

Everyone can take a look at this address first.

Http://friend.qq.com/cgi-bin/friend/oicq_find?ocq_no=5292816

(QQ is my own, I am very busy every day, please conscious, huh, huh, discuss the question very welcome)

The following we will get information through Tencent's friends.

<%

Function QQHEAD (QQ)

URL = "http://friend.qq.com/cgi-bin/friend/oicq_find?ocq_no=" & qq

Content = gethttppage (URL)

If LEN (Content)> 6360 Then 'If QQ is invalid, do some processing, avoid errors.

Content = Replace (MID (Content, INSTR (Content, "

http://img.tencent.com "), 38)," "" "" "" ")

QQHEAD = " "ELSE

QQHEAD = ""

END IF

END FUNCTION

'OK, I'm big me. Now everyone will call it.

Response.write qqhead (5292816)

If the QQ avatar is colored, a friend is online, and the ash is not online.

%>

Everyone can go

Http://www.okwest.net/books look at the effect. Oh, huh.

转载请注明原文地址:https://www.9cbs.com/read-22087.html

New Post(0)