关闭

asp 远程内容提取

245人阅读 评论(0) 收藏 举报

<%
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 

0
0

查看评论
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
    个人资料
    • 访问:1101234次
    • 积分:15519
    • 等级:
    • 排名:第693名
    • 原创:866篇
    • 转载:4篇
    • 译文:0篇
    • 评论:13条
    最新评论