<%
'声明取得目标信息的函数,通过XML组件实现。
Function GetURL(url)
Set Retrieval = CreateObject("Microsoft.XMLHTTP")
With Retrieval
.Open "GET", url, False
.Send
GetURL = bytes2bstr(.responsebody)
'对取得信息进行验证，如果信息长度小于100则说明截取失败
if len(.responsebody)<100 then
response.write "获取远程文件 <a href="&url&" target=_blank>"&url&"</a>失败."
response.end
end if

End With
Set Retrieval = Nothing
End Function
'二进制转字符串，否则会出现乱码。
Function bytes2bstr(vin)
strrerurn = ""
for i = 1 to lenb(vin)
thischarcode = ascb(midb(vin,i,1))
if thischarcode < &h80 then
strreturn = strreturn & chr(thischarcode)
else
nextcharcode = ascb(midb(vin,i+1,1))
strreturn = strreturn & chr(clng(thischarcode) * &h100 + cint(nextcharcode))
i = i + 1
end if
next
bytes2bstr = strreturn
end function
'声明截取的格式，从Start开始截取，到Last为结束
Function GetKey(HTML,Start,Last)
if instr(Html,"<div style=""padding-left:10px;line-height:20px;padding-top:1px"">")>0 then
filearray=split(HTML,Start)
filearray2=split(filearray(1),Last)
GetKey=filearray2(0)
else
Response.Write"<br><br><font color=#ff0000>　<b>不好意思，没有找到歌词~!</b></font><br><br>"
end if
End Function

MusicName=Request("MusicName")
if MusicName="" then
Response.Write"歌曲名不能为空"
Response.End 
end if
'要获取页面的URL
	Url="http://mp3.baidu.com/m?f=ms&rn=10&tn=baidump3lyric&ct=150994944&word="&MusicName&"&lm=-1"
	Html = GetURL(Url)
'截取采集对象页
	Songword = GetKey(Html,"<div style=""padding-left:10px;line-height:20px;padding-top:1px"">","<br><br><br>")
%>
<LINK href="../css/geci.css" rel=stylesheet type=text/css>
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" bgcolor="#ECFBFF">
<div align="center">

	<table border="0" width="100%">
		<tr>
			<td><%Response.Write SongWord%></td>
		</tr>
	</table>
</div>