Created
September 5, 2024 12:59
-
-
Save a1iraxa/f7f9769f53e2e91211ea629e8b3d7935 to your computer and use it in GitHub Desktop.
Server 2 Server Moving Files in PHP
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
echo "Downloading..."; | |
$source = 'https://abc.com/source/directory/and/path/to/large-file.zip'; | |
$destination = "/home/name/public_html/destination/path/large-file.zip"; | |
$ch = curl_init(); | |
curl_setopt($ch, CURLOPT_URL, $source); | |
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); | |
$data = curl_exec ($ch); | |
curl_close ($ch); | |
$file = fopen($destination, "w+"); | |
fputs($file, $data); | |
fclose($file); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment