function gethttppage(url)
dim http
set http=createobject("MICROSOFT.XMLHTTP")
http.open "GET",url,false
http.send()
if http.readystate<>4 then
exit function
end if
gethttppage=bytestostr(http.responseBody,"GB2312")
if err.number<>0 then err.clear
end function
function bytestostr(body,cset)
dim objstream
set objstream=createobject("adodb.stream")
objstream.type=1
objstream.mode=3
objstream.open
objstream.write body
objstream.position=0
objstream.type=2
objstream.charset=cset
bytestostr=objstream.readtext
objstream.close
set objstream=nothing
end function
function savetofile(bodyall,filename)
dim objstream1
set objstream1=createobject("adodb.stream")
objstream1.type=2
objstream1.open
objstream1.position=objstream1.size
objstream1.writetext bodyall
objstream1.savetofile filename,2
objstream1.close
set objstream1=nothing
end function
dim url,http
url="http://www.86516.com"
html=gethttppage(url)
'msgbox html
savefilename="index1.htm"
savetofile html,savefilename
function gethttppage(url)
dim http
set http=createobject("MICROSOFT.XMLHTTP")
http.open "GET",url,false
http.send()
if http.readystate<>4 then
exit function
end if
gethttppage=bytestostr(http.responseBody,"GB2312")
if err.number<>0 then err.clear
end function
function bytestostr(body,cset)
dim objstream
set objstream=createobject("adodb.stream")
objstream.type=1
objstream.mode=3
objstream.open
objstream.write body
objstream.position=0
objstream.type=2
objstream.charset=cset
bytestostr=objstream.readtext
objstream.close
set objstream=nothing
end function
function savetofile(bodyall,filename)
dim objstream1
set objstream1=createobject("adodb.stream")
objstream1.type=2
objstream1.open
objstream1.position=objstream1.size
objstream1.writetext bodyall
objstream1.savetofile filename,2
objstream1.close
set objstream1=nothing
end function
dim url,http
url="http://www.86516.com"
html=gethttppage(url)
'msgbox html
savefilename="index1.htm"
savetofile html,savefilename