[Materials] Use WinHTTP. winhttprequest.5.1

Source: Internet
Author: User
ArticleDirectory
    • Demo:
    • References:
Demo:
< %  Dim  Apisiteapisite = "  Http: // 127.0.0.1/XXXXX/  "  Dim  Freehost_t1  Dim  Freehost_t2  Dim  Freehost_t3  Dim Freehost_t4freehost_t1 = 20000  Freehost_t2 = 20000  Freehost_t3 = 30000  Freehost_t4 = 240000  Function  Getop (TAR, req)  Dim  Objxmlhttp  Set Objxmlhttp = server. Createobject ( " WinHTTP. winhttprequest.5.1  "  ) Objxmlhttp. Option (  6 ) = 0  Objxmlhttp. settimeouts freehost_t1, freehost_t2, freehost_t3, freehost_t4 objxmlhttp. Open  "  Get  " , Apisite & tar & "  ?  " & Req, False  Objxmlhttp. Send If Objxmlhttp. Status = 200   Then  Getop = Bytes2bstr (objxmlhttp. responsebody)  Else  Getop = "  HTTP status:  " & Objxmlhttp. Status & "  Information:  " & Bytes2bstr (objxmlhttp. responsebody) End   If      Set Objxmlhttp = Nothing  End Function  Function  Getopbyte (TAR, req)  Dim  Objxmlhttp  Set Objxmlhttp = server. Createobject ( "  WinHTTP. winhttprequest.5.1  "  ) Objxmlhttp. Option (  6 ) =0  Objxmlhttp. settimeouts freehost_t1, freehost_t2, freehost_t3, freehost_t4 objxmlhttp. Open  "  Get  " , Apisite & tar & "  ?  " & Req, False  Objxmlhttp. Send  If Objxmlhttp. Status = 200   Then  Getopbyte =Objxmlhttp. responsebody  Else  Getop = "  HTTP status:  " & Objxmlhttp. Status & "  Information:  " & Bytes2bstr (objxmlhttp. responsebody)  End   If      Set Objxmlhttp = Nothing End Function  Function  Postop (TAR, postbody)  Dim  Objxmlhttp  Set Objxmlhttp = server. Createobject ( "  WinHTTP. winhttprequest.5.1  "  ) Objxmlhttp. Option (  6 ) = 0  Objxmlhttp. settimeouts freehost_t1, freehost_t2, freehost_t3, freehost_t4 objxmlhttp. Open  " Post  " , Apisite & tar, False  Objxmlhttp. setRequestHeader  "  Content-Type  " , "  Application/X-WWW-form-urlencoded  "  Objxmlhttp. setRequestHeader  "  Content-Length  " , Len (Postbody) objxmlhttp. Send postbody  If Objxmlhttp. Status = 200   Then  Postop = Bytes2bstr (objxmlhttp. responsebody)  Else  Postop = "  HTTP status:  " & Objxmlhttp. Status & "  Information:  " &Bytes2bstr (objxmlhttp. responsebody)  End   If      Set Objxmlhttp = Nothing  End Function  Function  Bytes2bstr (VIN)  Dim  Bytesstream, stringreturn  Set Bytesstream = server. Createobject ( "  ADODB. Stream  " ) Bytesstream. Type = 2  Bytesstream. Open bytesstream. writetext Vin bytesstream. Position = 0  Bytesstream. charset = "  Big5  "  Bytesstream. Position = 2  Stringreturn = Bytesstream. readtext bytesstream. Close  Set Bytesstream =Nothing  Bytes2bstr = Stringreturn  End Function  % >

 
''Apiret = getop ("index. ASP "," Act = stockmoveresetpdf & Mid = "& mid _ &" & state1 = "& state1 &" & state2 = "& state2 &" & state3 = "& state3)
''Apiret = postop ("index. asp", request. Form)
References:

Http://www.docin.com/p-387428585.html

 

 

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.