+ -
当前位置:首页 → 问答吧 → xmlhttp取下来的东西还能控制吗

xmlhttp取下来的东西还能控制吗

时间:2004-04-21

来源:互联网

<%
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=bytesToBSTR(Http.responseBody,"GB2312")
                set http=nothing
                if err.number<>0 then err.Clear  
        End function
               
        Function BytesToBstr(body,Cset)
                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 = Cset
                BytesToBstr = objstream.ReadText
                objstream.Close
                set objstream = nothing
        End Function
        %>
        <%
        dim abc
        abc="http://www.jojy.net/programs/numnews/list_all.asp?username=zyzz&school=职业中专"
        response.write getHTTPPage(abc)%>

---------------------
上面是我的xmlhttp抓学校的新闻。可是头尾都有表格。
我只想单单其中的新闻。别的都不要。
有什么方法吗?

作者: a2a2a2   发布时间: 2004-04-21

如下的东西还要么?

首页 上一页 下一页 尾页


思路:把取得的源代码作为字符串进行处理,去掉无用的部分

作者: bencalie   发布时间: 2004-04-21

谢谢!老大。不要了
就保留10条最新的新闻就OK
能帮我写出这个源代码?

我很爱学,可这又不能一天就能成的事呀!但事情又要在最近完成~

所以请高手们帮我弄一下

作者: a2a2a2   发布时间: 2004-04-21

<%
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=bytesToBSTR(Http.responseBody,"GB2312")
        set http=nothing
        if err.number<>0 then err.Clear
    End function
    Function BytesToBstr(body,Cset)
        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 = Cset
        BytesToBstr = objstream.ReadText
        objstream.Close
        set objstream = nothing
    End Function
    %><%
dim arrtitle(),arrlink()
function ubb(str)
  qin=split(str,"javascript:winopen(")
redim arrtitle(ubound(qin)),arrlink(ubound(qin))
  for i=1 to ubound(qin)
newsstr=left(qin(i),instr(qin(i),"</a>")-1)
newstitle=mid(newsstr,instr(newsstr,">")+1)
newslink=left(newsstr,instr(newsstr,")")-1)
newslink=replace(newslink,"'","")
arrtitle(i)=replace(newstitle,"""",""")
arrlink(i)=newslink
ubb=ubb&"document.write("".<a href=http://www.jojy.net/programs/numnews/"&arrlink(i)&" target=_blank>"&arrtitle(i)&"</a><br>"");"  
next
end function
%>
    <%
    dim abc
   abc="http://www.jojy.net/programs/numnews/list_all.asp?username=zyzz&school=职业中专"
    zyzz=ubb(getHTTPPage(abc))%>
<%=zyzz%>

作者: a2a2a2   发布时间: 2004-04-24

请教:如果网页上有2个以上的表格;而我们只是需要取得其中的一个表格的内容,如:
<table id=1>......</table>
<table id=2>......</table>
在上面的这2个表格中,需要取出id=2的表格,而其他的内容都不需要,这样能不能做得到?

作者: iiasp   发布时间: 2004-05-03



QUOTE:
[i]a2a2a2[/i] 于 2004-4-24 22:01 写道:
<%
Function getHTTPPage(url)
    '    on error resume next
        dim http
        set http=Server.createobject("Microsoft.XMLHTTP")
        Http.open "GET",url,fal ...

上面的这些代玛要是能够加上注释,那就是象我这样的菜鸟上辈子修来的福份哦。。。





.

作者: iiasp   发布时间: 2004-05-03