Fungsi GetURL(url)Set Retrieval = CreateObject(Microsoft.XMLHTTP)Dengan Retrieval.Open GET, url, False.SendGetURL = bytes2bstr(.responsebody)'Verifikasi informasi yang diperoleh. Jika panjang informasi kurang dari 100, intersepsi gagal jika len( .responsebody)<100 laluresponse.write Dapatkan file jarak jauh<a href=&url& target=_blank>&url&</a> gagal. respon.endend ifEnd WithSet Retrieval = NothingEnd Function' Biner ke string, jika tidak, karakter kacau akan muncul! fungsi bytes2bstr(vin)strreturn = untuk i = 1 hingga lenb(vin)thischarcode = ascb(midb(vin,i,1))jika thischarcode < &h80 makastrreturn = strreturn & chr(thischarcode)elsenextcharcode = ascb(midb(vin,i ) +1,1))strreturn = strreturn & chr(clng(kode karakter ini) * &h100 + cint(nextcharcode))i = i + 1end ifnextbytes2bstr = strreturnend functionfunction savetofile(bodyall,nama file)dim objstream1set objstream1=createobject(adodb.stream)objstream1.type=2objstream1.openobjstream1.position=objstream1.sizeobjstream1.writetext bodyallobjstream1.savetofile filename,2objstream1.closeset objstream1=nothingend function' mendeklarasikan format intersepsi, dimulai dari Mulai dan berakhir di Last Function GetKey(HTML,Start,Last)filearray=split(HTML,Start)filearray2=split(filearray(1), Last) GetKey=filearray2(0)Fungsi Akhirurl=http://www.86516.comHtml = DapatkanURL(Url)savetofilehtml,ce.htm
Tipe kedua:
</P><P>fungsi gethttppage(url)dim httpsset http=createobject(MICROSOFT.XMLHTTP)http.open GET,url,falsehttp.send()if http.readystate<>4 lalu keluar dari fungsiend ifgethttppage=bytestostr(http.responseBody ,GB2312)jika err.number<>0 maka fungsi err.clearend</P><P>fungsi bytetostr(body,cset)dim objstreamset objstream=createobject(adodb.stream)objstream.type=1objstream.mode=3objstream.openobjstream.write bodyobjstream.position=0objstream.type=2objstream.charset=csetbytestostr=objstream.readtextobjstream.closeset objstream= fungsi tiada akhir</P><P>fungsi savetofile(bodyall,nama file)dim objstream1set objstream1=createobject(adodb.stream)objstream1.type=2objstream1.openobjstream1.position=objstream1.sizeobjstream1.writetext bodyallobjstream1.savetofile nama file,2objstream1.closeset objstream1=nothingend function</P><P> redup url,httpurl=http://www.86516.comhtml=gethttppage(url)'msgbox htmlsavefilename=index1.htmsavetofile html,simpan namafile</P><P>