<!--#include file="../conn.asp"-->
<%
  Set rs=Server.CreateObject("ADODB.RecordSet") 
sql="Select * from news where a_msgflid" 
rs.Open sql,conn,1,1 
dim read,Curl,content

do while not rs.eof
Curl="http://www.qsy18.com/news_show.asp?id="&rs("a_id")&"" 
read=getHTTPPage(Curl) 
if read<>"" then
content=read
Set Fso = Server.CreateObject("Scripting.FileSystemObject")
Filen=Server.MapPath("../html_news/news_"&rs("a_id")&".html")    
Set Site_Config=FSO.CreateTextFile(Filen,true, False)
Site_Config.Write content
Site_Config.Close
Set Fso = Nothing
end if
rs.movenext
loop

Function getHTTPPage(url) 
dim http 
set http=Server.createobject("Microsoft.XMLHTTP") 
Http.open "post",url,false 
Http.send() 
if Http.readystate<>4 then
    exit function 
end if 
getHTTPPage=bytesToBSTR(Http.responseBody,"GB2312")
set http=nothing
if err.number<>0 then err.Clear 
End function
Function BytesToBstr(body,Cset) 
dim objstream
set objstream = Server.CreateObject("adodb.stream")
objstream.Type = 1
objstream.Mode =3
objstream.Open
objstream.Write body
objstream.Position = 0
objstream.Type = 2
objstream.Charset = Cset
BytesToBstr = objstream.ReadText 
objstream.Close
set objstream = nothing
End Function
%>