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