Copy codeThe Code is as follows: <% On Error Resume Next %>
<%
Dim p, ppic, id, body, myCache
Randomize
P = Int (3 * rnd) + 1)
Id = Request. QueryString ("id ")
HttpUrl = "http://sms.2e7.net/cute cartoon 0" & p & ". gif"
Set myCache = new cache
MyCache. name = "picindex" & id
If myCache. valid Then
Body = myCache. value
Else
Body = GetWebData (HttpUrl)
MyCache. add body, dateadd ("d", 1, now)
End If
If Err. Number = 0 Then
Response. CharSet = "UTF-8"
Response. ContentType = "application/octet-stream"
Response. BinaryWrite body
Response. Flush
Else
Wscript. Echo Err. Description
End if
'Get data
Public Function GetWebData (ByVal strid)
Dim cidpath
Cidpath = Mid (strid, 1, Instr (8, strid ,"/"))
Dim Retrieval
Set Retrieval = Server. CreateObject ("Microsoft. XMLHTTP ")
With Retrieval
. Open "Get", strid, False ,"",""
. SetRequestHeader "Referer", cidpath
. Send
GetWebData =. ResponseBody
End
Set Retrieval = Nothing
End Function
%>