Sample code for 30+ languages & platforms
PHP ActiveX

Setting a HTTP Max Response Size

Demonstrates the MaxResponseSize property.

Chilkat PHP ActiveX Downloads

PHP ActiveX
<?php

$success = 0;

$http = new COM("Chilkat.Http");

$maxSz = 16384;
$http->MaxResponseSize = $maxSz;

// Try to get something larger, such as hamlet.xml which is 279658 bytes
$xmlStr = $http->quickGetStr('https://chilkatsoft.com/hamlet.xml');
if ($http->LastMethodSuccess == 0) {
    // If the LastErrorText contains the string "MaxResponseSize",
    // then the HTTP request failed because the response body would've been larger than the max allowed response size.
    print $http->LastErrorText . "\n";
    exit;
}

print 'OK' . "\n";

?>