Winhttpでhttpリクエストを行い、Cドライブ直下に”test.txt”というファイルにリクエスト結果を保存する例です。


Option Explicit

  Const OpenFileForReading   = 1
  Const OpenFileForWriting   = 2
  Const OpenFileForAppending = 8

  HTTPDownload "http://google.co.jp/index.html" , "c:\text.txt"
Sub HTTPDownload(ByVal STR_URL, ByVal STR_Path )
    Dim OBJ_File
    Dim OBJ_FSO
    Dim OBJ_HTTP

    Set OBJ_FSO  = CreateObject("Scripting.FileSystemObject")
    Set OBJ_File = OBJ_FSO.OpenTextFile(STR_Path, OpenFileForWriting, True)
    Set OBJ_HTTP = CreateObject("WinHttp.WinHttpRequest.5.1")

    OBJ_HTTP.Open "GET", STR_URL, False
    OBJ_HTTP.Send

    OBJ_File.Write  OBJ_HTTP.ResponseText
    OBJ_File.Close( )
End Sub

Scriptのダウンロードは こちら です。

60 Comments

  1. freee gay chat says:

    frree gay and bi chat sites in seattle wa https://gaychatcams.net/

  2. free sacramento gay chat says:

    gay black chat – live gay black men https://gaychatnorules.com/

Leave a Reply