28,391
社区成员
发帖
与我相关
我的任务
分享
private mbin() as byte
private mstate as integer
private mstrRet as string
public function gettitleinfo() '在类模块里引用
winsock.localport=0
winsock.remoteport=80
winsock.remotehost="www.csdn.net"
winsock.protocol=0
winsock.connect
while mstate<>conStateCompleted
doevents
wend
gettitleinfo=mstrRet
end function
private sub winsock_close()
mstate=conStateCompleted
mstrRet=procdata(mbin)
end sub
private sub winsock_connect()
dim strPost as string
strPost="GET / HTTP/1.0" & vbcrlf & "Host: www.csdn.net" & vbcrlf& "Accepte: */*" & vbcrlf & vbcrlf
winsock.sendData strPost
mstate=conStateBegin
end sub
private sub winsock_dataarrival(intSize integer)
if intSize<=0 then exit sub
winsock.getdata bin
AppendByte mbin,bin
if checktitle(mbin) then winsock.close
end sub
private sub checktitle()
checktitle=(instrb(mbin,"<title>")>0 and instr(mbin,"</title>")>0 )
end function