Sample code for 30+ languages & platforms
VBScript

HTTP POST with Binary Data in Request Body

See more HTTP Examples

Do an HTTPS POST with a binary request body.

Chilkat VBScript Downloads

VBScript
Dim fso, outFile
Set fso = CreateObject("Scripting.FileSystemObject")
'Create a Unicode (utf-16) output text file.
Set outFile = fso.CreateTextFile("output.txt", True, True)

success = 0

' This example assumes the Chilkat API to have been previously unlocked.
' See Global Unlock Sample for sample code.

set http = CreateObject("Chilkat.Http")

set fac = CreateObject("Chilkat.FileAccess")

reqBody = fac.ReadEntireFile("qa_data/pdf/helloWorld.pdf")

set resp = CreateObject("Chilkat.HttpResponse")
success = http.HttpBinary("POST","https://example.com/something",reqBody,"application/pdf",resp)
If (success = 0) Then
    outFile.WriteLine(http.LastErrorText)
    WScript.Quit
End If

responseStatusCode = resp.StatusCode
outFile.WriteLine("Status code: " & responseStatusCode)

' For example, if the response is XML, JSON, HTML, etc.
outFile.WriteLine("response body:")
outFile.WriteLine(resp.BodyStr)

outFile.Close