网络Online

程序,电脑,生活,股票

asp 远程内容提取

<%
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=bytes2BSTR(Http.responseBody)
 set http=nothing
 if err.number<>0 then err.Clear 
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 NewString(wstr,strng)
 NewString=Instr(wstr,strng)
End Function


Function RemoveHTML(strText)
Dim RegEx

Set RegEx = New RegExp

RegEx.Pattern = "<[^>]*>"
RegEx.Global = True

RemoveHTML = RegEx.Replace(strText, "")
End Function

Function Newstring(wstr,strng)
Newstring=Instr(lcase(wstr),lcase(strng))
if Newstring<=0 then Newstring=Len(wstr)
End Function

aa=getHTTPPage("http://www.cnxz.cn/agent/brand-list.php")
'start=Newstring(aa,"所有品牌")
'over=Newstring(aa,"<td height=""10"" background=""images/pphc-7.gif""></td>")
'body=mid(aa,start,over-start)

aa=RemoveHTML(aa)
Response.Write aa

 

%>

来自:Http://www.xrss.cn 

阅读更多
文章标签: asp function regex url
个人分类: 程序
想对作者说点什么? 我来说一句

没有更多推荐了,返回首页

不良信息举报

asp 远程内容提取

最多只允许输入30个字

加入CSDN,享受更精准的内容推荐,与500万程序员共同成长!
关闭
关闭