PHP
Chilkat2 PHP
Inspect HTTP Request Header
Demonstrates theLastHeader property.
Chilkat PHP Downloads
<?php
use Chilkat2\Http;
use Chilkat2\HttpResponse;
$http = new 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 HttpResponse();
try {
$http->HttpStr('POST', $url, $json, 'utf-8', 'application/json', $resp);
} catch (\Chilkat2\Exception $e) {
echo $e->getMessage(), "\n";
exit;
}
// Examine the HTTP request header we just sent.
echo $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