A good example of XMLHTTP

Source: Internet
Author: User
Although users not registered with ting88 cannot download songs, it is not difficult to do so: Enter the www.ting88.com website, copy the artist album page URL to the text box and then submit it to get the download path of the song, such as: http://www.ting88.com/MusicLis

Although users who are not registered with ting88 cannot download songs, it is not difficult to solve it :)

Into the site www.ting88.com, copy the artist album page URL to the text box and then submit it to get the download path of the song, such as: http://www.ting88.com/MusicList/4141.htm

The source program is as follows:

Reference content is as follows:
<%
On error resume next
Dim id, url, getCode, m, I, j, s, d, ns, nd, num, name
Id = trim (request. querystring ("id "))
'1. retrieve all content on the original webpage
Function getHTTPPage (url)
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

'2. encoding conversion
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
Reference content is as follows:
'Get the plaintext URL
Function MyReplace (ConvStr)
ConvStr = replace (ConvStr, "YVI", "1 ")
ConvStr = replace (ConvStr, "ESR", "2 ")
ConvStr = replace (ConvStr, "SXN", "3 ")
ConvStr = replace (ConvStr, "STI", "4 ")
ConvStr = replace (ConvStr, "WFU", "5 ")
ConvStr = replace (ConvStr, "LQU", "6 ")
ConvStr = replace (ConvStr, "QGI", "7 ")
ConvStr = replace (ConvStr, "BLA", "8 ")
ConvStr = replace (ConvStr, "JFU", "9 ")
ConvStr = replace (ConvStr, "LSN", "0 ")
ConvStr = replace (ConvStr, "XPG ","/")
ConvStr = replace (ConvStr, "XQD ",".")
ConvStr = replace (ConvStr ,"","")
ConvStr = replace (ConvStr, "% 20 ","")
ConvStr = replace (ConvStr, "KWD", "Wma ")
MyReplace = ConvStr
End function

If id = "1" then
Url = trim (request. form ("txturl "))
If url = "" then
Response. redirect ("GetMusic. asp ")
Response. end ()
End if
'Url = "http://www.ting88.com/MusicList/1454.htm"
S = 0
D = 0
Ns = 0
Nd = 0
GetCode = getHTTPPage (url)
Num = mid (getCode, limit Rev (getCode, ". name = mid (getCode, instr (getCode," artist name: ") 'Get artist
M = "http: // 218.75.78.189/33445566 /"
Response. write"

On this page, find "& name &" & num & "first song "&"

"
Response. write"
Page URL: "& url &"
"
Response. write"








"For I = 1 to numS = instr (I s, getCode, "checked" "value = '")D = instr (I d, getCode, "KWD '> ")Ns = instr (I ns, getCode, "word = ")Nd = instr (I nd, getCode, "& inc = ")Response. write" "NextResponse. write"
Serial Number Song name Control
"& I &" "& Mid (getCode, ns 5, nd-ns-5 )&"
Download
"
End if



%>



Obtain the URL of an album Song







Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.