ASP实现头像图像随机变换_ASP教程-查字典教程网
ASP实现头像图像随机变换
ASP实现头像图像随机变换
发布时间:2016-12-29 来源:查字典编辑
摘要:复制代码代码如下:

复制代码 代码如下:

<%OnErrorResumeNext%>

<%

dimp,ppic,id,body,myCache

randomize

p=Int((3*rnd)+1)

id=Request.QueryString("id")

HttpUrl="http://sms.2e7.net/可爱卡通0"&p&".gif"

SetmyCache=newcache

myCache.name="picindex"&id

IfmyCache.validThen

body=myCache.value

Else

body=GetWebData(HttpUrl)

myCache.addbody,dateadd("d",1,now)

EndIf

IfErr.Number=0Then

Response.CharSet="UTF-8"

Response.ContentType="application/octet-stream"

Response.BinaryWritebody

Response.Flush

Else

Wscript.EchoErr.Description

Endif

'取得数据

PublicFunctionGetWebData(ByValstrid)

Dimcidpath

cidpath=Mid(strid,1,Instr(8,strid,"/"))

DimRetrieval

SetRetrieval=Server.CreateObject("Microsoft.XMLHTTP")

WithRetrieval

.Open"Get",strid,False,"",""

.setRequestHeader"Referer",cidpath

.Send

GetWebData=.ResponseBody

EndWith

SetRetrieval=Nothing

EndFunction

%>

相关阅读
推荐文章
猜你喜欢
附近的人在看
推荐阅读
拓展阅读
  • 大家都在看
  • 小编推荐
  • 猜你喜欢
  • 最新ASP教程学习
    热门ASP教程学习
    编程开发子分类