Chilkat Examples

ChilkatHOMEAndroid™AutoItCC#C++Chilkat2-PythonCkPythonClassic ASPDataFlexDelphi DLLGoJavaNode.jsObjective-CPHP ExtensionPerlPowerBuilderPowerShellPureBasicRubySQL ServerSwiftTclUnicode CUnicode C++VB.NETVBScriptVisual Basic 6.0Visual FoxProXojo Plugin

DataFlex Examples
Web API Categories

ASN.1
AWS KMS
AWS Misc
Amazon EC2
Amazon Glacier
Amazon S3
Amazon S3 (new)
Amazon SES
Amazon SNS
Amazon SQS
Async
Azure Cloud Storage
Azure Key Vault
Azure Service Bus
Azure Table Service
Base64
Box
CAdES
CSR
CSV
Cert Store
Certificates
Cloud Signature CSC
Code Signing
Compression
DKIM / DomainKey
DNS
DSA
Diffie-Hellman
Digital Signatures
Dropbox
Dynamics CRM
EBICS
ECC
Ed25519
Email Object
Encryption
FTP
FileAccess
Firebase
GMail REST API
GMail SMTP/IMAP/POP
Geolocation
Google APIs
Google Calendar
Google Cloud SQL
Google Cloud Storage
Google Drive
Google Photos
Google Sheets
Google Tasks
Gzip
HTML-to-XML/Text
HTTP
HTTP Misc
IMAP
JSON
JSON Web Encryption (JWE)
JSON Web Signatures (JWS)
JSON Web Token (JWT)
Java KeyStore (JKS)
MHT / HTML Email
MIME
Microsoft Graph
Misc
NTLM
OAuth1
OAuth2
OIDC
Office365
OneDrive
OpenSSL
Outlook
Outlook Calendar
Outlook Contact
PDF Signatures
PEM
PFX/P12
PKCS11
POP3
PRNG
REST
REST Misc
RSA
Regular Expressions
SCP
SCard
SFTP
SMTP
SSH
SSH Key
SSH Tunnel
ScMinidriver
Secrets
SharePoint
SharePoint Online
Signing in the Cloud
Socket/SSL/TLS
Spider
Stream
Tar Archive
ULID/UUID
Upload
WebSocket
X
XAdES
XML
XML Digital Signatures
XMP
Zip
curl
uncategorized

 

 

 

(DataFlex) HTTP Response Inspection

See more HTTP Examples
Demonstrates how to inspect the HTTP response, including the status code, status text, and response headers, for Chilkat methods that don't use an HttpResponse object.

Chilkat ActiveX Downloads

ActiveX for 32-bit and 64-bit Windows

Use ChilkatAx-win32.pkg

Procedure Test
    Handle hoHttp
    String sJsonText
    Handle hoMime
    Boolean iSuccess
    Integer iNumHeaders
    Integer i
    String sTemp1
    Integer iTemp1

    Get Create (RefClass(cComChilkatHttp)) To hoHttp
    If (Not(IsComObjectCreated(hoHttp))) Begin
        Send CreateComObject of hoHttp
    End

    // Returns the contents of the response body.
    Get ComQuickGetStr Of hoHttp "https://chilkatsoft.com/helloWorld.json" To sJsonText

    // Examine the response status code.
    Get ComLastStatus Of hoHttp To iTemp1
    Showln "response status code: " iTemp1

    // Examine the response status text
    Get ComLastStatusText Of hoHttp To sTemp1
    Showln "response status text: " sTemp1

    // Examine the full response header.
    Showln "response header:"
    Get ComLastResponseHeader Of hoHttp To sTemp1
    Showln sTemp1
    Showln "----"

    // Examine the response content-type
    Get ComLastContentType Of hoHttp To sTemp1
    Showln "LastContentType = " sTemp1

    // Examine the response last-mod date
    Get ComLastModDate Of hoHttp To sTemp1
    Showln "LastModDate = " sTemp1

    // Load the response header into a Chilkat MIME object to access its fields individually.
    Get Create (RefClass(cComChilkatMime)) To hoMime
    If (Not(IsComObjectCreated(hoMime))) Begin
        Send CreateComObject of hoMime
    End
    Get ComLastResponseHeader Of hoHttp To sTemp1
    Get ComLoadMime Of hoMime sTemp1 To iSuccess

    Get ComNumHeaderFields Of hoMime To iNumHeaders
    Move 0 To i
    Showln "---- MIME Headers ----"
    While (i < iNumHeaders)
        Get ComGetHeaderFieldName Of hoMime i To sTemp1
        Showln "name:  " sTemp1
        Get ComGetHeaderFieldValue Of hoMime i To sTemp1
        Showln "value: " sTemp1
        Move (i + 1) To i
    Loop

    Showln "----"

    // Get a header field value by name:
    Get ComGetHeaderField Of hoMime "ETag" To sTemp1
    Showln "ETag: " sTemp1

    // Output:

    // response status code: 200
    // response status text: OK
    // response header:
    // Content-Type: application/json
    // Last-Modified: Sun, 20 Aug 2023 11:36:27 GMT
    // Accept-Ranges: bytes
    // ETag: "34c27f8e5ad3d91:0"
    // Server: Microsoft-IIS/10.0
    // X-Powered-By: ASP.NET
    // Date: Sat, 30 Aug 2025 14:38:13 GMT
    // Content-Length: 22
    // ----
    // LastContentType = application/json
    // LastModDate = 2023-08-20
    // ---- MIME Headers ----
    // name:  Content-Type
    // value: application/json
    // name:  Last-Modified
    // value: Sun, 20 Aug 2023 11:36:27 GMT
    // name:  Accept-Ranges
    // value: bytes
    // name:  ETag
    // value: "34c27f8e5ad3d91:0"
    // name:  Server
    // value: Microsoft-IIS/10.0
    // name:  X-Powered-By
    // value: ASP.NET
    // name:  Date
    // value: Sat, 30 Aug 2025 14:38:13 GMT
    // name:  Content-Length
    // value: 22
    // ----
    // ETag: "34c27f8e5ad3d91:0"


End_Procedure

 

© 2000-2025 Chilkat Software, Inc. All Rights Reserved.