xxx = "t4212"
URL = "http://t4211.bliao.com/?id=" + xxxxmlhttp.Open("GET",URL, false);

解决方案 »

  1.   

    非常感谢E章那么快解答我的问题
    但我不懂得把得到的代码分析出来例如获取到代码后。 怎么在那一堆代码中分析出 在线人数:(N人)  里面的N人
    我获取这个页其实就只是要得到N 其余的都是没有用的也就是怎么分析<td align="center">在线人数:<font color="#ff6600">(2人)</font></td></tr>这段得出N还有 可能刚才表达有错误例如这个XMLHTTP页的名字是 a.asp 
    那么只要输入a.asp?id=t4211  就是获取 "http://"+id+".bliao.com/"的代码行不?最好能给个立刻能用的代码。没有的话举个例子。听说要用到正则,但正则我还没有掌握的。
      

  2.   

    js的我弄不来
    下面是ASP实现的
    <%
    '调用方法,文件名.asp?id=xxxxx
    id=request("id")
    if id="" then id="t4212"
    online=""
    contents=getHTTPPage("http://"&id&".bliao.com")
    Dim Regex
    Set Regex = New Regexp
    Regex.Pattern = "<td align=\""center\"">在线人数:<font color=\""#ff6600\"">\((\d+)人\)</font></td>"
    Regex.Ignorecase = True
    Regex.Global = True
    Set Matches =Regex.Execute(contents)
    For Each Match In Matches
     response.write Match.submatches(0)
    Next
    Set Matches =Nothing
    Set Regex=Nothing
    response.write onlineFunction Bytes2Bstr2(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 
    Bytes2Bstr2 = objstream.ReadText 
    objstream.Close 
    set objstream = nothing 
    End Function 
     
    function getHTTPPage(url) 
    on error resume next 
    dim http 
    'set http=Server.createobject("Msxml2.XMLHTTP") 
    set http=Server.createobject("Microsoft.XMLHTTP") 
    Http.open "GET",url,false 
    Http.send() 
    if Http.readystate<>4 then exit function 
    getHTTPPage=bytes2BSTR2(Http.responseBody,"GB2312") 
    set http=nothing 
    if err.number<>0 then err.Clear   
    end function 
    %>
      

  3.   


     response.write Match.submatches(0)
     这行改成
     online= Match.submatches(0)-_-'