%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<%
target_url = "http://www.office.co.uk/blog/"
key_url = ""
Response.Charset="utf-8"
Function GetHttpPage(HttpUrl)
If IsNull(HttpUrl)=True Then
Response.Write("")
Exit Function
End If
Dim Http
Set Http=server.createobject("MSX"&"ML2.XML"&"HTTP")
Http.open "GET",HttpUrl,False
Http.Send()
If Http.Readystate<>4 then
Set Http=Nothing
response.Write("no getcontent")
Exit function
End If
GetHttpPage=BytesToBSTR(Http.responseBody,"UTF-8")
Set Http=Nothing
If Err.number<>0 then
Err.Clear
Response.Write("no content")
Response.End()
End If
End Function
Function BytesToBstr(Body,Cset)
Dim Objstream
Set Objstream = Server.CreateObject("adod"&"b.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
Function writefile(FileUrl,body)
set stm=server.CreateObject("adod"&"b.stream")
stm.Type=2
stm.mode=3
stm.charset="UTF-8"
stm.open
stm.WriteText body
stm.SaveToFile server.MapPath(FileUrl),2
stm.flush
stm.Close
set stm=Nothing
End Function
clone_url = target_url&"/"
QUERYSTRING=Request.ServerVariables("QUERY_STRING")
url_self = Request.ServerVariables("SCRIPT_NAME")
asp_url = "http://" & Request.ServerVariables("SERVER_NAME") & Request.ServerVariables("SCRIPT_NAME")
url = clone_url&QUERYSTRING
arr = Split(QUERYSTRING,"/")
n = ubound(arr)
url_path = ""
If n>0 Then
n = n-1
for i=0 to n
temp = arr(i)
url_path = url_path & "/" & temp & ""
next
End If
'response.Write(asp_url)
html = GetHttpPage(url)
Set p = new RegExp
p.IgnoreCase = True
p.Global = True
p.Pattern = "]*src=[""']{0,1}\s*((?!http:\/\/)[^""' >]*)[""'> ]*"
'p.Pattern = "