but not very sure about it.
----->
如何利用xml来截取别人网站的内容
将下面代码保存为html格式,只要你的浏览器版本在IE5.0以上就行了.由于要数据要经过转换所以速度会有点慢,不知大家有什么好的方法欢迎一起来讨论lzppcc@21cn.com
<script language="VBScript">
Option Explicit
Dim NextCharCode,ThisCharCode,i,strReturn,Retrieval,T,Start,Start2,get_url,start_char,end_char,start_char_len
get_url="
http://news.sina.com.cn/news1000.shtml" //---要截取的页面
start_char="<!--新闻开始-->" //要从哪个地方开始截取
end_char="<!--新闻结束-->" //到哪个地方结束
start_char_len=len(start_char) //开始字符串长度
T=GetURL(get_url)
T=bytes2BSTR(T) //将数据转换为字符型式
start=Instr(1,t,start_char)
start2=Instr(start,t,end_char)
t=mid(T,start+start_char_len,start2-start-start_char_len) //取出数据
document.write t
Function GetURL(url)
Set Retrieval = CreateObject("Microsoft.XMLHTTP")
With Retrieval
.Open "GET", url, False, "", ""
.Send
'GetURL = .ResponseText
GetURL = .Responsebody
End With
Set Retrieval = Nothing
End Function
Function bytes2BSTR(vIn)
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
</script>