ฟังก์ชัน GetURL(url)Set Retrieval = CreateObject(Microsoft.XMLHTTP)With Retrieval.Open GET, url, False.SendGetURL = bytes2bstr(.responsebody)'ตรวจสอบข้อมูลที่ได้รับ หากความยาวของข้อมูลน้อยกว่า 100 การสกัดกั้นจะล้มเหลวหาก len( .responsebody)<100 แล้วresponse.write รับไฟล์ระยะไกล<a href=&url& target=_blank>&url&</a> ล้มเหลว response.endend ifEnd WithSet Retrieval = NothingEnd Function' ไบนารีเป็นสตริง ไม่เช่นนั้นอักขระที่อ่านไม่ออกจะปรากฏขึ้น! ฟังก์ชั่น bytes2bstr(vin)strreturn = for i = 1 ถึง lenb(vin)thischarcode = ascb(midb(vin,i,1))ถ้า thischarcode < &h80 แล้วstrreturn = strreturn & chr(thischarcode)elsenextcharcode = ascb(midb(vin,i ) +1,1))strreturn = strreturn & chr(clng(รหัสอักขระนี้) * &h100 + cint (รหัสถัดไป)) i = i + 1end ifnextbytes2bstr = strreturnend functionfunction savetofile (bodyall, ชื่อไฟล์) dim objstream1set objstream1 = createobject (adodb.stream) objstream1.type = 2objstream1.openobjstream1.position = objstream1.sizeobjstream1.writetext bodyallobjstream1.savetofile filename,2objstream1.closeset objstream1=nothingend function' ประกาศรูปแบบการสกัดกั้น เริ่มต้นจาก Start และสิ้นสุดที่ Last Function GetKey(HTML,Start,Last)filearray=split(HTML,Start)filearray2=split(filearray(1), Last) GetKey=filearray2(0)End Functionurl=http://www.86516.comHtml = GetURL(Url)savetofilehtml,ce.htm
ประเภทที่สอง:
</P><P>ฟังก์ชัน gethttppage(url)dim httpset http=createobject(MICROSOFT.XMLHTTP)http.open GET,url,falsehttp.send()if http.readystate<>4 จากนั้นฟังก์ชันถัดไปจะสิ้นสุด ifgethttppage=bytestostr(http.responseBody ,GB2312)ถ้า err.number<>0 ดังนั้น ฟังก์ชัน err.clearend</P><P>ฟังก์ชัน bytestostr(body,cset)สลัว objstreamset objstream=createobject(adodb.stream)objstream.type=1objstream.mode=3objstream.openobjstream.write bodyobjstream.position=0objstream.type=2objstream.charset=csetbytestostr=objstream.readtextobjstream.closeset objstream= ฟังก์ชันไม่มีอะไรสิ้นสุด</P><P>ฟังก์ชัน savetofile (bodyall, ชื่อไฟล์) dim objstream1set objstream1=createobject(adodb.stream)objstream1.type=2objstream1.openobjstream1.position=objstream1.sizeobjstream1.writetext bodyallobjstream1.savetofile ชื่อไฟล์,2objstream1.closeset objstream1=nothingend function</P><P> สลัว url,httpurl=http://www.86516.comhtml=gethttppage(url)'msgbox htmlsavefilename=index1.htmsavetofile html,บันทึกชื่อไฟล์</P><P>