This is an example of downloading files using cURL, from which you can start:
$ch = curl_init('http://api.blabla.com/huhu.php');
curl_setopt_array($ch, array(
CURLOPT_POSTFIELDS => array(
'files[]' => '@/path/to/file',
),
));
if (false === ($res = curl_exec($ch))) {
die("Upload failed: " . curl_error($ch));
}
A string '@/path/to/file'is of particular importance since it begins with @; the line that immediately follows it should contain the path to the file you want to download.
source
share