I want to transfer a file from one host to another through PHP and cURL. This is my code :
<?php
$source = 'https://drive.google.com/uc?id=xxxxxxxxxxxxxxxxx&export=download';
$fh = fopen( basename( $source ), 'w' );
$ch = curl_init( $source );
curl_setopt( $ch, CURLOPT_FILE, $fh );
curl_exec( $ch );
curl_close( $ch );
fclose( $fh );
echo 'yes';
?>
An empty file is created on the destination host with the name : uc?id=xxxxxxxxxxxxxxxxx&export=download.
I have 2 questions :
- Why does it show zero volume on the destination host?
- The name of the file on the source host is index.html, how can I change it from uc?id=xxxxxxxxxxxxxxxxxx&export=download to index.html when transferring to the destination host?
I hope you help. Thank you.