How to use wget in php?

You can use the exec function in PHP to execute the wget command. Here's an example:

exec("wget -O /path/to/save/file.txt http://www.example.com/file.txt");

This will download the file at http://www.example.com/file.txt and save it as /path/to/save/file.txt on the server.

Keep in mind that the exec function can be disabled on some servers for security reasons, so it might not work on all servers.

Alternatively, you can use PHP's built-in HTTP functions, such as file_get_contents or curl, to download files from a URL. Here's an example using file_get_contents:

$file = file_get_contents("http://www.example.com/file.txt");
file_put_contents("/path/to/save/file.txt", $file);

This will download the file at http://www.example.com/file.txt and save it as /path/to/save/file.txt on the server.