PHP Code:
$url = 'http://www.webgains.com/newsletter/images/DiscountCodes.csv';
$filename = 'codes.csv';
$newfname = $filename;
$file = fopen ($url, "rb");
if ($file) {
$newf = fopen ($newfname, "wb");
if ($newf)
while(!feof($file)) {
fwrite($newf, fread($file, 1024 ), 1024 );
}
}
if ($file) {
fclose($file);
}
if ($newf) {
fclose($newf);
}
That's what I use and it works fine.
If you need to use cURL then change the request to https and add these to your options:
PHP Code:
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
Bookmarks