Frequently Used functions when making ASP thieves.

Source: Internet
Author: User

Frequently Used functions when making ASP thieves.

Collection page:
Function getpage (URL)
Dim senddata, Retrieval
Set retrieval = Createobject ("Microsoft. XMLHTTP ")
With Retrieval
. Open "Post", URL, false
. SetRequestHeader "Content-Type", "application/X-WWW-form-urlencoded"
. SetRequestHeader "User-Agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0;. Net CLR 1.1.4322 )"
. Send ()
Getpage = bytestobstr (. responsebody)
End
Set retrieval = nothing
End Function
Conversion garbled characters:
Function bytestobstr (Body)
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 = "gb2312"
Bytestobstr = objstream. readtext
Objstream. Close
Set objstream = nothing
End Function
Obtains the specified content.
Function getcontent (STR, start, last, n)
If instr (lcase (STR), lcase (start)> 0 then
Select case n
Case 0' truncates left and right (both take the front) (place keyword)
Getcontent = right (STR, Len (STR)-instr (lcase (STR), lcase (start)-len (start) + 1)
Getcontent = left (getcontent, instr (lcase (getcontent), lcase (last)-1)
Case 1 'intercept both the left and right (both take the front) (retain the keyword)
Getcontent = right (STR, Len (STR)-instr (lcase (STR), lcase (start) + 1)
Getcontent = left (getcontent, instr (lcase (getcontent), lcase (last) + Len (last)-1)
Case 2 'only truncate to the right (take the previous one) (remove the keyword)
Getcontent = right (STR, Len (STR)-instr (lcase (STR), lcase (start)-len (start) + 1)
End select
Else
Getcontent = ""
End if
End Function

Delete HTML tags:
Function delhtml (htmlcode)
Dim istart, iend
Dim stemp
Stemp = htmlcode
Istart = instr (stemp, "<")
Iend = instr (stemp, "> ")
Do While istart> 0 and iend> 0 and iend-istart> 0
Stemp = Replace (stemp, mid (stemp, istart, iend-istart + 1 ),"")
Istart = instr (stemp, "<")
Iend = instr (stemp, "> ")
Loop
Delhtml = stemp
End Function

 

Related Article

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.