You may want to automate the task downloading files from the web or remote area to your local storage space, you can use the PHP for this purpose.
It can be done by using the code below.
$original_file = fopen("http://localhost/file/location/1.mp3", 'rb');
$read_file = fread($original_file,filesize("1.mp3"));
$destination = fopen("2.mp3",'wb');
fopen() : this function is used to open the file in specified mode.
There are several file open modes in php.
‘r’ mode , opens file to read only.
‘r+’ mode, opens file to read and write, the pointer is placed at the beginning.
‘w’ mode, the file is to write only, file pointer is placed at the beginning of the file, if file doesn’t exist then the file is automatically created. Continue reading Download and save content from web to local storage using PHP