(PHP ActiveX) Transition from Http.PutBinary to Http.HttpBinary
Provides instructions for replacing deprecated PutBinary method calls with HttpBinary. Note: This example requires Chilkat v11.0.0 or greater.
<?php
$success = 0;
$http = new COM("Chilkat.Http");
$verb = 'PUT';
$url = 'https://example.com/';
$contentType = 'application/octet-stream';
// ------------------------------------------------------------------------
// The PutBinary method is deprecated:
$responseBody = $http->putBinary($url,$byteData,$contentType,0,0);
if ($http->LastMethodSuccess == 0) {
print $http->LastErrorText . "\n";
exit;
}
// ...
// ...
// ------------------------------------------------------------------------
// Do the equivalent using HttpBinary.
$responseOut = new COM("Chilkat.HttpResponse");
$success = $http->HttpBinary($verb,$url,$byteData,$contentType,$responseOut);
if ($success == 0) {
print $http->LastErrorText . "\n";
exit;
}
$responseBody = $responseOut->BodyStr;
?>
|