Sample code for 30+ languages & platforms
PHP ActiveX

Inspect HTTP Request Header

Demonstrates the LastHeader property.

Chilkat PHP ActiveX Downloads

PHP ActiveX
<?php

$success = 0;

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

$url = 'https://chilkatsoft.com/echo_request_body.asp';
$json = '{\'greeting\':\'Hello World\'}';

// Send a POST with the JSON in the HTTP request body.
$resp = new COM("Chilkat.HttpResponse");
$success = $http->HttpStr('POST',$url,$json,'utf-8','application/json',$resp);
if ($success == 0) {
    print $http->LastErrorText . "\n";
    exit;
}

// Examine the HTTP request header we just sent.
print $http->LastHeader . "\n";

// Output:

// POST /echo_request_body.asp HTTP/1.1
// Host: chilkatsoft.com
// Accept: */*
// Accept-Encoding: gzip
// Content-Type: application/json
// Content-Length: 26

?>