How can server access and command line tools like wget be utilized to download files in PHP scripts?

To download files in PHP scripts using server access and command line tools like wget, you can use the `exec()` function to execute the wget command. This allows you to download files from a given URL directly within your PHP script.

<?php
$url = 'http://example.com/file-to-download.txt';
$saveTo = '/path/to/save/file.txt';

exec("wget $url -O $saveTo");