创力采集程序用到的函数 推荐第1/3页(4)
End If
TempStr=TempStr & ">" & RsI("ItemName")
TempStr=TempStr & "</option>"
RsI.Movenext
Loop
End if
RsI.Close
Set RsI=Nothing
TempStr=TempStr & "</select>"
Response.Write TempStr
End sub
'==================================================
'函数名:GetHttpPage
'作 用:获取网页源码
'参 数:HttpUrl ------网页地址
'==================================================
Function GetHttpPage(HttpUrl)
If IsNull(HttpUrl)=True Or Len(HttpUrl)<18 Or HttpUrl="$False$" Then
GetHttpPage="$False$"
Exit Function
End If
Dim Http
On Error Resume Next
Set Http=server.createobject("MSXML2.XMLHTTP")
Http.open "GET",HttpUrl,False
Http.Send()
If Http.Readystate<>4 then
Set Http=Nothing
GetHttpPage="$False$"
Exit function
End if
GetHTTPPage=bytesToBSTR(Http.responseBody,"GB2312")
Set Http=Nothing
If Err.number<>0 then Err.Clear
End Function
'==================================================
'函数名:BytesToBstr
'作 用:将获取的源码转换为中文
'参 数:Body ------要转换的变量
'参 数:Cset ------要转换的类型
'==================================================
Function BytesToBstr(Body,Cset)
Dim Objstream
On Error Resume Next
Set Objstream = Server.CreateObject("Adodb." & "Str" & "eam")
objstream.Type = 1
objstream.Mode =3
objstream.Open
objstream.Write body
objstream.Position = 0
objstream.Type = 2
objstream.Charset = Cset
BytesToBstr = objstream.ReadText
内容版权声明:除非注明,否则皆为本站原创文章。