读取类似这样的播放列表 http://5yaoqcc.cn/mp3.xml
由于我自己要的播放列表也蛮多,所以读取了不同网站上的播放列表文件,最近经常出现服务器上的ASP文件打开慢,但是XML文件或静态网页可以打开,我想是因为我写的这种ASP程序在读取别人的播列时没有判断别人的服务器是否正常,所以不停的链结,结果IIS资源耗尽,造成了IIS假死,每次我都是重启服务器才好
下面我附上ASP文件的源码,希望对这方面了解的朋友能帮上忙,在此谢过了
ASP程序:
----------------------------------------------------------------------------
<script language="javascript" runat="server">
function loadXML(){
try{
var x=Server.CreateObject("microsoft.xmlhttp");
x.open("GET"," http://5yaoqcc.cn/mp3.xml",false);
x.send(null);
t=b2s(x.responseBody);
t=t.replace(/[\n\r]+/gi,"");
var mp3url=[];
var pt=/mp3url="([\s\S]*?)"/gi;
var tp="";
while((tp=pt.exec(t))!=null){
mp3url.push(RegExp.$1);
}
Response.Write("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
Response.Write("<list>\n");
if(mp3url.length>10){
mp3url.length=10;
}
for(var i=0;i<mp3url.length-1;i++){
Response.Write("<song>");
Response.Write("<url>"+mp3url[i]+"</url>");
Response.Write("</song>\n");
}
Response.Write("</list>");
}
catch(e){
Response.Write(e.description);
}
}
</script>
<script language="vbscript" runat="server">
Function b2s(arrBytes)
strReturn = ""
arrBytes = CStr(arrBytes)
For i = 1 To LenB(arrBytes)
ThisCharCode = AscB(MidB(arrBytes, i, 1))
If ThisCharCode < &H80 Then
strReturn = strReturn & Chr(ThisCharCode)
Else
NextCharCode = AscB(MidB(arrBytes, i+1, 1))
strReturn = strReturn & Chr(CLng(ThisCharCode) * &H100 + CInt(NextCharCode))
i = i + 1
End If
Next
b2s = strReturn
End Function
loadXML()
</script>
----------------------------------------------------------------------------
XML文件内容:
----------------------------------------------------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<info>
<mp3 mp3name="QCC精品店原创作品" mp3url=" http://www44.babidou.com/pic/2009/3/7/tblele/dj01.png" lrcurl=" http://5yaoqcc.cn/1.txt">
<mp3 mp3name="购买QCC请联系我们" mp3url=" http://www44.babidou.com/pic/2009/3/7/tblele/dj02.png" lrcurl=" http://5yaoqcc.cn/1.txt">
<mp3 mp3name="我们的QQ:231114111" mp3url=" http://www44.babidou.com/pic/2009/3/7/tblele/dj03.png" lrcurl=" http://5yaoqcc.cn/1.txt">
<mp3 mp3name="「QCC音乐盒」-推荐" mp3url=" http://www44.babidou.com/pic/2009/3/7/tblele/dj04.png" lrcurl=" http://5yaoqcc.cn/1.txt">
<mp3 mp3name="「QCC音乐盒」-推荐" mp3url=" http://www44.babidou.com/pic/2009/3/7/tblele/dj05.png" lrcurl=" http://5yaoqcc.cn/1.txt">
<mp3 mp3name="「QCC音乐盒」-推荐" mp3url=" http://www44.babidou.com/pic/2009/3/7/tblele/dj06.png" lrcurl=" http://5yaoqcc.cn/1.txt">
<mp3 mp3name="「QCC音乐盒」-推荐" mp3url=" http://www44.babidou.com/pic/2009/3/7/tblele/dj07.png" lrcurl=" http://5yaoqcc.cn/1.txt">
<mp3 mp3name="「QCC音乐盒」-推荐" mp3url=" http://www44.babidou.com/pic/2009/3/7/tblele/dj08.png" lrcurl=" http://5yaoqcc.cn/1.txt">
<mp3 mp3name="「QCC音乐盒」-推荐" mp3url=" http://www44.babidou.com/pic/2009/3/7/tblele/dj09.png" lrcurl=" http://5yaoqcc.cn/1.txt">
<mp3 mp3name="「QCC音乐盒」-推荐" mp3url=" http://www44.babidou.com/pic/2009/3/7/tblele/dj10.png" lrcurl=" http://5yaoqcc.cn/1.txt">
<mp3 mp3name="「QCC音乐盒」-推荐" mp3url=" http://www44.babidou.com/pic/2009/3/7/tblele/dj11.png" lrcurl=" http://5yaoqcc.cn/1.txt">
<mp3 mp3name="「QCC音乐盒」-推荐" mp3url=" http://www44.babidou.com/pic/2009/3/7/tblele/dj12.png" lrcurl=" http://5yaoqcc.cn/1.txt">
<mp3 mp3name="「QCC音乐盒」-推荐" mp3url=" http://www44.babidou.com/pic/2009/3/7/tblele/dj13.png" lrcurl=" http://5yaoqcc.cn/1.txt">
<mp3 mp3name="「QCC音乐盒」-推荐" mp3url=" http://www44.babidou.com/pic/2009/3/7/tblele/dj14.png" lrcurl=" http://5yaoqcc.cn/1.txt">
<mp3 mp3name="「QCC音乐盒」-推荐" mp3url=" http://www44.babidou.com/pic/2009/3/7/tblele/dj15.png" lrcurl=" http://5yaoqcc.cn/1.txt">
<mp3 mp3name="「QCC音乐盒」-推荐" mp3url=" http://www44.babidou.com/pic/2009/3/7/tblele/dj16.png" lrcurl=" http://5yaoqcc.cn/1.txt">
<mp3 mp3name="「QCC音乐盒」-推荐" mp3url=" http://www44.babidou.com/pic/2009/3/7/tblele/dj17.png" lrcurl=" http://5yaoqcc.cn/1.txt">
<mp3 mp3name="「QCC音乐盒」-推荐" mp3url=" http://www44.babidou.com/pic/2009/3/7/tblele/dj18.png" lrcurl=" http://5yaoqcc.cn/1.txt">
<mp3 mp3name="「QCC音乐盒」-推荐" mp3url=" http://www44.babidou.com/pic/2009/3/7/tblele/dj19.png" lrcurl=" http://5yaoqcc.cn/1.txt">
<mp3 mp3name="「QCC音乐盒」-推荐" mp3url=" http://www44.babidou.com/pic/2009/3/7/tblele/dj20.png" lrcurl=" http://5yaoqcc.cn/1.txt">
</info>
----------------------------------------------------------------------------
我现在的想法是加载XML文件时,判断是否能加载到,不能加载的话,给出个提示,或生成个别的XML文件,或调用我自己服务器上的备用播放列表文件,
在此等候您的好消息哦! ^.^