Skip to content

Instantly share code, notes, and snippets.

@a1iraxa
Created September 5, 2024 12:59
Show Gist options
  • Save a1iraxa/f7f9769f53e2e91211ea629e8b3d7935 to your computer and use it in GitHub Desktop.
Save a1iraxa/f7f9769f53e2e91211ea629e8b3d7935 to your computer and use it in GitHub Desktop.
Server 2 Server Moving Files in PHP
<?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