Sample code for 30+ languages & platforms
PHP Extension

Transition from Http.PTextSb to Http.HttpSb

Provides instructions for replacing deprecated PTextSb method calls with HttpSb.

Chilkat PHP Extension Downloads

PHP Extension
<?php

include("chilkat.php");

$success = false;

$http = new CkHttp();

$verb = 'PUT';
$url = 'https://example.com/';
$sbRequestBody = new CkStringBuilder();
$sbRequestBody->Append('This is the HTTP request body');
$charset = 'utf-8';
$contentType = 'text/plain';

// ------------------------------------------------------------------------
// The PTextSb method is deprecated:

// responseObj is a CkHttpResponse
$responseObj = $http->PTextSb($verb,$url,$sbRequestBody,$charset,$contentType,false,false);
if ($http->get_LastMethodSuccess() == false) {
    print $http->lastErrorText() . "\n";
    exit;
}

// ...
// ...

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

$responseOut = new CkHttpResponse();
$success = $http->HttpSb($verb,$url,$sbRequestBody,$charset,$contentType,$responseOut);
if ($success == false) {
    print $http->lastErrorText() . "\n";
    exit;
}


?>