ASP XMLHTTP Component Contract _ Thief/Collection

Source: Internet
Author: User

XMLHTTP component Contract in ASP
Write a thief function, pay attention to the Red Code section, the other add it yourself!
Function Posthttppagefrom (Httpurl,stra,fromurl)
Dim Http
Set http=server.createobject ("MSXML2. XMLHTTP ")
Http.open "POST", Httpurl,false
Http.setrequestheader "Content-length", Len (stra) Http.setrequestheader "content-
Type "," application/x-www-form-urlencoded "
Http.setrequestheader "Referer", Fromurl
Http.send Stra
If Http.readystate<>4 Then
Set http=nothing
Gethttppage= "$False $"
Exit function
End If
Posthttppagefrom=bytestobstr (Http.responsebody, "gb2312") Set http=nothing
If Err.number<>0 Then
Err.Clear
End If
End Function
Function Bytestobstr (Body,cset)
Dim objstream
Set objstream = Server.CreateObject ("ADODB.stream")
Objstream. Type = 1
Objstream. Mode =3
Objstream. Open1 d)
Objstream. Write body
Objstream. Position = 0
Objstream. Type = 2
Objstream. Charset = Cset
Bytestobstr = objstream. ReadText
Objstream. Close
Set objstream = Nothing
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.