PHP
Chilkat2 PHP
Setting a HTTP Max Response Size
Demonstrates theMaxResponseSize property.
Chilkat PHP Downloads
<?php
use Chilkat2\Http;
$http = new Http();
$maxSz = 16384;
$http->MaxResponseSize = $maxSz;
// Try to get something larger, such as hamlet.xml which is 279658 bytes
try {
$xmlStr = $http->QuickGetStr('https://chilkatsoft.com/hamlet.xml');
} catch (\Chilkat2\Exception $e) {
// 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.
echo $e->getMessage(), "\n";
exit;
}
echo "OK\n";