| 发表于:2007-01-31 20:40:15 楼主 |
dim mycommand as string dim getpage as string private sub command1_click() with winsock1 .remotehost = "www.baidu.com " .remoteport = 80 .connect end with end sub private sub winsock1_connect() dim mycommand as string on error resume next mycommand = text2.text '给远程计算机发送数据 winsock1.senddata mycommand end sub private sub winsock1_dataarrival(byval bytestotal as long) winsock1.getdata webdata, text debug.print webdata if instr(data, "content-type: ") then dim pos%, length%, head$ pos = instr(data, vbcrlf & vbcrlf) length = len(data) head = left(data, pos - 1) data = right(data, length - pos - 3) getpage = data end if text1 = getpage end sub text2里面的内容是: get / http/1.1 accept: */* accept-language: zh-cn ua-cpu: x86 accept-encoding: gzip, deflate user-agent: mozilla/4.0 (compatible; msie 7.0; windows nt 5.1; maxthon) host: www.baidu.com connection: keep-alive cookie: baiduid=e7abb1bd7d6ece10d367e035be6660dd 为什么这样拿到的数据是乱码呢? |
|
|
|
|