With the following php script one could request for a response with specific content-type, size and content-disposition.
Copy the below content to /var/www/html/askme.php and access http://server/askme.php?help
<?php
if(isset($_GET['help']))
{
header("Content-type: text/html");
echo "<h2>usage: http://" . $_SERVER["SERVER_NAME"] . $_SERVER["PHP_SELF"] . "?size=<num><K|M|G>&type=<content-type>&filename=<name>" ;
echo "<h2>example: http://" . $_SERVER["SERVER_NAME"] . $_SERVER["PHP_SELF"] . "?size=10K&type=image/png" ;
exit;
}
if(isset($_GET['size'])) $size=$_GET['size']; else $size=0;
if(isset($_GET['type'])) $type=$_GET['type']; else $type="application/octet-stream";
header("Content-type: $type");
if(isset($_GET['filename']))
{
header('Content-Disposition: attachment; filename="'. $_GET['filename'] .'"');
}
system ("dd if=/dev/zero bs=$size count=1");
?>
Copy the below content to /var/www/html/askme.php and access http://server/askme.php?help
<?php
if(isset($_GET['help']))
{
header("Content-type: text/html");
echo "<h2>usage: http://" . $_SERVER["SERVER_NAME"] . $_SERVER["PHP_SELF"] . "?size=<num><K|M|G>&type=<content-type>&filename=<name>" ;
echo "<h2>example: http://" . $_SERVER["SERVER_NAME"] . $_SERVER["PHP_SELF"] . "?size=10K&type=image/png" ;
exit;
}
if(isset($_GET['size'])) $size=$_GET['size']; else $size=0;
if(isset($_GET['type'])) $type=$_GET['type']; else $type="application/octet-stream";
header("Content-type: $type");
if(isset($_GET['filename']))
{
header('Content-Disposition: attachment; filename="'. $_GET['filename'] .'"');
}
system ("dd if=/dev/zero bs=$size count=1");
?>