zoukankan      html  css  js  c++  java
  • 使用SQL定时触发VBSCRIPT脚本发送HTTP请求

    test.vbs文件代码如下图:

     1  ScriptTimeout = 120
     2  function getHTTPPage(url) 
     3   on error resume next 
     4   dim http 
     5   set http=CreateObject("Microsoft.XMLHTTP") 
     6   Http.open "GET",url,false 
     7   Http.send() 
     8   if Http.readystate<>4 then
     9    exit function 
    10   end if 
    11   getHTTPPage=bytes2BSTR(Http.responseBody) 
    12   set http=nothing
    13   if err.number<>0 then err.Clear  
    14  end function
    15 
    16  Function bytes2BSTR(vIn) 
    17   dim strReturn 
    18   dim i1,ThisCharCode,NextCharCode 
    19   strReturn = "" 
    20   For i1 = 1 To LenB(vIn) 
    21    ThisCharCode = AscB(MidB(vIn,i1,1)) 
    22    If ThisCharCode < &H80 Then 
    23     strReturn = strReturn & Chr(ThisCharCode) 
    24    Else 
    25     NextCharCode = AscB(MidB(vIn,i1+1,1)) 
    26     strReturn = strReturn & Chr(CLng(ThisCharCode) * &H100 + CInt(NextCharCode)) 
    27     i1 = i1 + 1 
    28    End If 
    29   Next 
    30   bytes2BSTR = strReturn 
    31  End Function 
    32  
    33  Function GetMid(txt,StrOne,StrTwo)
    34  NumOne = Instr(txt,StrOne)
    35  NumTwo = Instr(txt,StrTwo)
    36  if NumOne=0 or NumTwo=0 Then GetMid="":Exit Function
    37  GetMid = Mid(txt,NumOne+Len(StrOne),NumTwo-NumOne-Len(StrOne))
    38  End Function
    39  
    40  Dim htmSource
    41  htmSource=getHTTPPage("http://localhost/test/absa.asp")
    View Code
  • 相关阅读:
    c#之字符串,列表,接口,队列,栈,多态
    c#之函数
    KMP算法
    字符串Hash
    洛谷P1807 最长路_NOI导刊2010提高(07)
    洛谷P2863 [USACO06JAN]牛的舞会The Cow Prom
    洛谷P2071 座位安排
    二分图最大匹配,匈牙利算法
    差分约束系统
    搜索
  • 原文地址:https://www.cnblogs.com/webczw/p/3366430.html
Copyright © 2011-2022 走看看