Sample code for 30+ languages & platforms
PHP ActiveX Requires Chilkat v11.0.0+

Transition from Http.GetHead to Http.HttpNoBody

Provides instructions for replacing deprecated GetHead method calls with HttpNoBody.

Chilkat PHP ActiveX Downloads

PHP ActiveX
<?php

$success = 0;

$http = new COM("Chilkat.Http");
$url = 'https://www.example.com/';

//  ------------------------------------------------------------------------
//  The GetHead method is deprecated:

// resp1 is a Chilkat.HttpResponse
$resp1 = $http->GetHead($url);
if ($http->LastMethodSuccess == 0) {
    print $http->LastErrorText . "\n";
    exit;
}

print $resp1->StatusCode . "\n";

//  ------------------------------------------------------------------------
//  Do the equivalent using HttpNoBody.
//  Your application creates a new, empty response object which is passed 
//  in the last argument and filled with the HTTP response upon success.

$resp2 = new COM("Chilkat.HttpResponse");
$success = $http->HttpNoBody('HEAD',$url,$resp2);
if ($success == 0) {
    print $http->LastErrorText . "\n";
    exit;
}

print $resp2->StatusCode . "\n";

?>