How to download the text file from the specified URL in PHP | PHP program
We will demonstrate how we can download a text file from a specified URL using the PHP program.
<?php
$download_url = 'https://www.tutorialslink.com/sample.txt';
header('Content-Type: application/octet-stream');
header("Content-Transfer-Encoding: utf-8");
header("Content-disposition: attachment; filename=\"" . basename($download_url) . "\"");
readfile($download_url);
?>


