Sample code for 30+ languages & platforms
Classic ASP

HTTP POST with Binary Data in Request Body

See more HTTP Examples

Do an HTTPS POST with a binary request body.

Chilkat Classic ASP Downloads

Classic ASP
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<%
success = 0

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

set http = Server.CreateObject("Chilkat.Http")

set fac = Server.CreateObject("Chilkat.FileAccess")

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

set resp = Server.CreateObject("Chilkat.HttpResponse")
success = http.HttpBinary("POST","https://example.com/something",reqBody,"application/pdf",resp)
If (success = 0) Then
    Response.Write "<pre>" & Server.HTMLEncode( http.LastErrorText) & "</pre>"
    Response.End
End If

responseStatusCode = resp.StatusCode
Response.Write "<pre>" & Server.HTMLEncode( "Status code: " & responseStatusCode) & "</pre>"

' For example, if the response is XML, JSON, HTML, etc.
Response.Write "<pre>" & Server.HTMLEncode( "response body:") & "</pre>"
Response.Write "<pre>" & Server.HTMLEncode( resp.BodyStr) & "</pre>"

%>
</body>
</html>