谁是卧底优惠码是什么:帮我解释ASP这个程序

来源:百度文库 编辑:高考问答 时间:2024/05/05 06:36:40
Function getHTTPPage(url)
On Error Resume Next
dim http
set http=Server.createobject("Microsoft.XMLHTTP")
Http.open "GET",url,false
Http.send()
if Http.readystate<>4 then
exit function
end if
getHTTPPage=bytesToBSTR(Http.responseBody,"GB2312")
set http=nothing
If Err.number<>0 then
Response.Write "<p align='center'><font color='red'><b>服务器获取文件内容出错</b></font></p>"
Err.Clear
End If
End function
没一行帮我解释一下~!

Function getHTTPPage(url) ---定义函数
On Error Resume Next ---忽略错误
dim http ---定义变量http
set http=Server.createobject("Microsoft.XMLHTTP") ---建立XMLHTTP对象
Http.open "GET",url,false ----设置http对象打开方式 GET方式,URL[连接页面地址],同步处理
Http.send() ----发送请求
if Http.readystate<>4 then ----对象处理状态为 非结束
exit function --------退出函数
end if
getHTTPPage=bytesToBSTR(Http.responseBody,"GB2312") ---接收数据并转换
set http=nothing
If Err.number<>0 then ----错误代码非0则出错
Response.Write "<p align='center'><font color='red'><b>服务器获取文件内容出错</b></font></p>"
Err.Clear ---清除错误
End If
End function