判断远程图片是否存在的ASP技巧

函数:

Function CheckURL(byval A_strUrl)
set XMLHTTP = Server.CreateObject("Microsoft.XMLHTTP")
XMLHTTP.open "HEAD",A_strUrl,false
XMLHTTP.send()
CheckURL=(XMLHTTP.status=200)
set XMLHTTP = nothing
End function

 

调用:

Dim imgurl
imgurl="http://www.abc.com/UploadFiles/2007829144940734.gif"
if CheckURL(imgurl) then
response.write "图片存在"
else
response.write "图片不存在"
end if

你可能感兴趣的:(asp)