Chilkat Examples

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

PHP ActiveX 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

 

 

 

(PHP ActiveX) Debugging HTTP

To debug a failed HTTP request or an unexpected response, start by gathering more information about the event. The Chilkat Http class provides several properties to assist in this process. The most valuable is the SessionLogFilename property, which you can set to a file path where the Http object will log the complete requests and responses. Reviewing this log helps ensure the requests sent to the server are correctly formatted and contain the expected data.

Additionally, the standard LastErrorText, LastErrorXml, and LastErrorHtml properties offer insights into what occurred during the last method call for a given object instance. These properties record details regardless of the method's success or failure status. Setting the VerboseLogging property to 1 provides more detailed information in LastErrorText, but it's recommended to review LastErrorText without VerboseLogging first and enable it only if necessary.

There are other properties for quick and accessible details, such as LastHeader, LastStatus, WasRedirected, LastContentType, and more.

Chilkat ActiveX Downloads

ActiveX for 32-bit and 64-bit Windows

Note: The php_com_dotnet.dll may need to be enabled inside of php.ini.

<?php

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

$http = new COM("Chilkat.Http");

// This example demonstrates session logging via the
// SessionLogFilename property.  It also examines the 
// contents of the LastErrorText and a few other properties
// to see what transpired in a seemingly simple HTTP GET request.

$http->SessionLogFilename = 'c:/temp/qa_output/httpSessionLog.txt';

// The "http://www.paypal.com" URL was chosen on
// purpose to demonstrate the potential complexity
// of a seemingly simple HTTP GET request and response.
// 
// In this case, the initial response is a 302 redirect to
// "https://www.paypal.com/" because all communication
// with PayPal must be over SSL/TLS.  The Chilkat HTTP
// FollowRedirects property defaults to 1, causing the
// redirect to be followed automatically.  
// The request is resent using SSL/TLS and the response
// received is a complex one:  it is both Gzipped (compressed)
// and "chunked".  Internally, Chilkat automatically handles
// the decompression and the re-composing of the chunked
// response to return the simple HTML page that is the result.

$html = $http->quickGetStr('http://www.paypal.com/');

// Looking at the httpSessionLog, we can see the initial
// HTTP request, the 302 response, the subsequent 
// HTTP GET request to follow the redirect, and the final
// gzipped/chunked response:

// ---- Sending Wed, 20 Aug 2025 11:10:12 GMT ----
// GET / HTTP/1.1
// Host: www.paypal.com
// Accept: */*
// Accept-Encoding: gzip
// 
// 
// ---- Received Wed, 20 Aug 2025 11:10:12 GMT ----
// HTTP/1.1 302 Found
// Connection: close
// Content-Length: 0
// Server: Varnish
// Retry-After: 0
// Location: https://www.paypal.com/us/home
// Accept-Ranges: bytes
// Date: Wed, 20 Aug 2025 11:10:13 GMT
// Via: 1.1 varnish
// X-Served-By: cache-chi-klot8100033-CHI
// X-Cache: HIT
// X-Cache-Hits: 0
// Server-Timing: content-encoding;desc="",x-cdn;desc="fastly"
// 
// 
// ---- Sending Wed, 20 Aug 2025 11:10:12 GMT ----
// GET /us/home HTTP/1.1
// Host: www.paypal.com
// Accept: */*
// Accept-Encoding: gzip
// 
// 
// ---- Received Wed, 20 Aug 2025 11:10:12 GMT ----
// HTTP/1.1 200 OK
// Connection: keep-alive
// x-content-type-options: nosniff
// cache-control: max-age=0, no-cache, no-store, must-revalidate
// timing-allow-origin: *
// ...
// ...
// content-encoding: gzip
// ...
// ...
// transfer-encoding: chunked
// 
// 2ef4
// ...
// ...
// ...

?>

 

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