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


Option Explicit

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

  Const adTypeBinary = 1 'Binary
  Const adTypeText   = 2 'Text

  Const adSaveCreateNotExist  = 1
  Const adSaveCreateOverWrite = 2
  HTTPDownload "http://dragon-ark.com/wp-content/uploads/2008/12/20081231_1-300x166.gif" , "c:\test.gif"

 Sub HTTPDownload(ByVal STR_URL, ByVal STR_Path )
    Dim OBJ_ADO
    Dim OBJ_HTTP
    Dim STR_Temp

    Set OBJ_ADO  = CreateObject("ADODB.Stream")

    OBJ_ADO.Type = adTypeBinary
    OBJ_ADO.Open
    OBJ_ADO.Position = 0

    Set OBJ_HTTP = CreateObject("WinHttp.WinHttpRequest.5.1")

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

    STR_Temp = OBJ_HTTP.ResponseBody
    OBJ_ADO.Write STR_Temp
    OBJ_ADO.SaveToFile STR_Path, adSaveCreateNotExist
    OBJ_ADO.Close
End Sub

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

20 Comments

  1. gửi hàng đi mỹ says:

    … [Trackback]

    […] Find More on on that Topic: dragon-ark.com/archives/170 […]

  2. gửi hàng đi mỹ says:

    … [Trackback]

    […] Information on that Topic: dragon-ark.com/archives/170 […]

  3. exchange online plan 1 says:

    … [Trackback]

    […] Information to that Topic: dragon-ark.com/archives/170 […]

  4. internet bağlantısı kopuyor says:

    … [Trackback]

    […] Read More Information here on that Topic: dragon-ark.com/archives/170 […]

  5. fresh dumps with pin says:

    … [Trackback]

    […] Find More to that Topic: dragon-ark.com/archives/170 […]

  6. HP Servis says:

    … [Trackback]

    […] Read More on on that Topic: dragon-ark.com/archives/170 […]

  7. it danışmanlığı says:

    … [Trackback]

    […] There you will find 84045 more Information on that Topic: dragon-ark.com/archives/170 […]

  8. sunucu teknik servis says:

    … [Trackback]

    […] Read More here to that Topic: dragon-ark.com/archives/170 […]

  9. kurumsal sunucu yapılandırma says:

    … [Trackback]

    […] Info on that Topic: dragon-ark.com/archives/170 […]

  10. dark0de market url says:

    … [Trackback]

    […] Find More on that Topic: dragon-ark.com/archives/170 […]

  11. thi công villa tại hội an says:

    … [Trackback]

    […] Find More on to that Topic: dragon-ark.com/archives/170 […]

  12. 무료신천지게임 says:

    … [Trackback]

    […] Find More Info here on that Topic: dragon-ark.com/archives/170 […]

  13. 쿠쿠티비 says:

    … [Trackback]

    […] Read More on that Topic: dragon-ark.com/archives/170 […]

  14. free web site creation says:

    … [Trackback]

    […] Find More on that Topic: dragon-ark.com/archives/170 […]

  15. sig sauer p938 says:

    … [Trackback]

    […] Here you will find 94177 additional Info on that Topic: dragon-ark.com/archives/170 […]

  16. kardinal stick says:

    … [Trackback]

    […] Read More on on that Topic: dragon-ark.com/archives/170 […]

  17. relx says:

    … [Trackback]

    […] Find More here on that Topic: dragon-ark.com/archives/170 […]

  18. Firearms For Sale Near Me says:

    … [Trackback]

    […] Find More Information here to that Topic: dragon-ark.com/archives/170 […]

  19. clubechecs.com says:

    … [Trackback]

    […] Read More here to that Topic: dragon-ark.com/archives/170 […]

  20. บาคาร่า1688 says:

    … [Trackback]

    […] Read More on to that Topic: dragon-ark.com/archives/170 […]

Leave a Reply