Created
May 8, 2015 11:30
-
-
Save hiraba-dqx/8ade68c305001cbed55b to your computer and use it in GitHub Desktop.
Basic認証有りのサイトにXML Post for Visual Basic6.0
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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