<%
const savepath="tempfile/"
函數 myreplace(str)
新聞str=str
設定 objregEx = 新正規表示式
objregEx.IgnoreCase = true
objregEx.Global = true
objregEx.Pattern = " http://(.+?).(jpg|gif|png|bmp )"
設定匹配= objregEx.execute(str)
比賽中的每場比賽
newstr=replace(newstr,match.value,saveimg(match.value))
下一個
myreplace=newstr
結束函數
function saveimg(url)
臨時=分割(網址,“。”)
隨機化
ranNum=int(90000*rnd)+10000
檔案名稱=年(現在)&月(現在)&日(現在)&小時(現在)&分鐘(現在)&秒(現在)&ranNum&"."&temp(ubound(temp))
設定 xmlhttp=server.createobject("Microsoft.XMLHTTP")
xmlhttp.open“獲取”,url,false
xmlhttp.發送
如果 xmlhttp.status<>200 那麼
保存圖像=“”
別的
img=xmlhttp.ResponseBody
設定 objAdostream=server.createobject("ADODB.Stream")
objAdostream.Open()
objAdostream.type=1
objAdostream.Write(img)
objAdostream.SaveToFile(server.mappath("./"&savepath&檔名)))
objAdostream.SetEOS
設定 objAdostream=無
saveimg=儲存路徑&檔名
結束如果
設定 xmlhttp=無
結束函數
%>