Skip to content

Instantly share code, notes, and snippets.

@hiraba-dqx
Created May 8, 2015 11:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hiraba-dqx/8ade68c305001cbed55b to your computer and use it in GitHub Desktop.
Save hiraba-dqx/8ade68c305001cbed55b to your computer and use it in GitHub Desktop.
Basic認証有りのサイトにXML Post for Visual Basic6.0
Dim domDoc As New MSXML2.DOMDocument
Dim xmlHttp As New MSXML2.XMLHTTP60
Dim str64 as String
domDoc.Load ("XMLファイルのパス")
xmlHttp.Open "POST", "https://hogehoge.com/authentication", False, "id", "pass"
'上記の方法で認証に失敗する場合はIDとパスを:で連結したものをBase64に変換 gstrBase64は自作のものに置き換えて使用してください
'str64 = gstrBase64( "id" & ":" & "pass")
'xmlHttp.setRequestHeader "Authorization", "Basic " & str64
xmlHttp.setRequestHeader "Content-Type", "text/xml;charset=utf-8"
xmlHttp.setRequestHeader "Content-Length", Len(domDoc.xml)
xmlHttp.send domDoc
' ダウンロード待ち
Do While xmlHttp.readyState <> 4
Loop
'MsgBox (xmlHttp.responseText)
'MsgBox (xmlHttp.statusText)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment