PowerBuilder
PowerBuilder
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 anHttpResponse object.
Chilkat PowerBuilder Downloads
integer li_rc
oleobject loo_Http
string ls_JsonText
oleobject loo_Mime
integer li_NumHeaders
integer i
loo_Http = create oleobject
li_rc = loo_Http.ConnectToNewObject("Chilkat.Http")
if li_rc < 0 then
destroy loo_Http
MessageBox("Error","Connecting to COM object failed")
return
end if
// Returns the contents of the response body.
ls_JsonText = loo_Http.QuickGetStr("https://chilkatsoft.com/helloWorld.json")
// Examine the response status code.
Write-Debug "response status code: " + string(loo_Http.LastStatus)
// Examine the response status text
Write-Debug "response status text: " + loo_Http.LastStatusText
// Examine the full response header.
Write-Debug "response header:"
Write-Debug loo_Http.LastResponseHeader
Write-Debug "----"
// Examine the response content-type
Write-Debug "LastContentType = " + loo_Http.LastContentType
// Examine the response last-mod date
Write-Debug "LastModDate = " + loo_Http.LastModDate
// Load the response header into a Chilkat MIME object to access its fields individually.
loo_Mime = create oleobject
li_rc = loo_Mime.ConnectToNewObject("Chilkat.Mime")
loo_Mime.LoadMime(loo_Http.LastResponseHeader)
li_NumHeaders = loo_Mime.NumHeaderFields
i = 0
Write-Debug "---- MIME Headers ----"
do while i < li_NumHeaders
Write-Debug "name: " + loo_Mime.GetHeaderFieldName(i)
Write-Debug "value: " + loo_Mime.GetHeaderFieldValue(i)
i = i + 1
loop
Write-Debug "----"
// Get a header field value by name:
Write-Debug "ETag: " + loo_Mime.GetHeaderField("ETag")
// 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"
destroy loo_Http
destroy loo_Mime