+ -
当前位置:首页 → 问答吧 → xmlhttp问题,谢谢各位

xmlhttp问题,谢谢各位

时间:2005-12-16

来源:互联网

请问我可以用IFRAME把其他网站上的只有新闻部分加进来么?
比如http://www.acs-inc.com。我只需要里面新闻的部分,达到新闻同步的效果。
谢谢各位,如果有其他办法,也请告诉我,谢谢了
只要可以达到新闻的同步更新就可以,谢谢了
用XMLHTTP怎么实现哪?
谢谢了

作者: realjerry   发布时间: 2005-12-16

<code>
<%
function getHTTPPage(http://www.acs-inc.com)
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=bytesToBstr(Http.responseBody,"GB2312")
set http=nothing
if err.number<>0 then err.Clear
end function
function BytesToBstr(body)
dim objstream
set objstream = Server.CreateObject("adodb.stream")
objstream.Type = 1
objstream.Mode =3
objstream.Open
objstream.Write body
objstream.Position = 0
objstream.Type = 2
objstream.Charset = "GB2312"
BytesToBstr = objstream.ReadText
objstream.Close
set objstream = nothing
End Function

Dim Url,Html
Url="http://www.acs-inc.com";
Html = getHTTPPage(Url)
Response.write Html
%>
<%
……
Dim StrBK,start,over,RsBK
StrBK=getHTTPPage(http://www.acs-inc.com)
start=Instr(StrBK,"<TD vAlign=top align=left width=294>") + 17
over=Instr(StrBK,"…</td></tr>")
RsBK=mid(StrBK,start,over-start)
response.write(RsBK)
%></code>
这么写对么?帮忙看一下

[ 本帖由 realjerry 最后编辑于 2005-12-16 15:37 ]

作者: realjerry   发布时间: 2005-12-16