Sample code for 30+ languages & platforms
PowerShell

Transition from Http.PTextSb to Http.HttpSb

Provides instructions for replacing deprecated PTextSb method calls with HttpSb.

Chilkat PowerShell Downloads

PowerShell
Add-Type -Path "C:\chilkat\ChilkatDotNet47-x64\ChilkatDotNet47.dll"

$success = $false

$http = New-Object Chilkat.Http

$verb = "PUT"
$url = "https://example.com/"
$sbRequestBody = New-Object Chilkat.StringBuilder
$sbRequestBody.Append("This is the HTTP request body")
$charset = "utf-8"
$contentType = "text/plain"

# ------------------------------------------------------------------------
# The PTextSb method is deprecated:

$responseObj = $http.PTextSb($verb,$url,$sbRequestBody,$charset,$contentType,$false,$false)
if ($http.LastMethodSuccess -eq $false) {
    $($http.LastErrorText)
    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-Object Chilkat.HttpResponse
$success = $http.HttpSb($verb,$url,$sbRequestBody,$charset,$contentType,$responseOut)
if ($success -eq $false) {
    $($http.LastErrorText)
    exit
}