专注主机服务与安全!
  • 网站黑链监测软件

为什么选择我们

  • 18年机房维护经验
  • 多款自研安全工具
  • 国内海外多机检测
  • 在线自动实时检测
  • 独家文件监控功能
  • 检测故障自动恢复
  • 保障全年不间断运行
  • 7*24小时技术维护

如何获取网页标题的ASP代码
 
发布时间:2023/10/11 13:26:06
 
如何获取网页标题的ASP代码

<%
Function getHTTPPage(url)
on error resume next
dim http
set http=Server.createobject("Msxml2.XMLHTTP")
Http.open "GET",url,false
Http.send()
if Http.readystate<>4 then
exit function
end if
getHTTPPage=bytes2BSTR(Http.responseBody)
set http=nothing
if err.number<>0 then
err.Clear
end if
End Function

Function bytes2BSTR(vIn)
dim strReturn
dim i,ThisCharCode,NextCharCode
strReturn = ""
For i = 1 To LenB(vIn)
ThisCharCode = AscB(MidB(vIn,i,1))
If ThisCharCode < &H80 Then
strReturn = strReturn & Chr(ThisCharCode)
Else
NextCharCode = AscB(MidB(vIn,i+1,1))
strReturn = strReturn & Chr(CLng(ThisCharCode) * &H100 + CInt(NextCharCode))
i = i + 1
End If
Next
bytes2BSTR = strReturn
End Function

Function GetPageTitle(HtmlContent)
Dim l,j,strTitle
l = InStr(LCase(HtmlContent), "<title>")
If l > 0 Then
l = l + 7
j = InStr(l, LCase(HtmlContent), "</title>")
If j > 0 Then
strTemp = Mid(HtmlContent, l, j - l)
Else
strTemp = "无法获取网页标题!"
End If
Else
strTemp = "无法获取网页标题!"
End If
GetPageTitle = strTemp
End Function

HtmlCldeContent = getHTTPPage("https://www.ietdata.com") '要提取页面的url地址
Title = GetPageTitle(HtmlCldeContent)
response.write(Title)
%>
   因尔特网络数据中心 18年老牌idc服务商为你提供云主机、高防服务器、虚拟主机、域名、网站建设、APP制作、SSL证书等,欢迎咨询!
 
 
微信客服
 
网页客服