I’ve to download the pdf files related to the data from the web source. I know the full path of the file. I’ve tried with curl but it is taking long time and writing a 0 byte file.
$ch = curl_init ($url);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_BINARYTRANSFER,1);
$rawdata = curl_exec($ch);
curl_close ($ch);
if(file_exists($fullpath)){
unlink($fullpath);
}
$fp = fopen($fullpath,'x');
fwrite($fp, $rawdata);
fclose($fp);
http://www.php.net/manual/en/curl.examples-basic.php
Or with this (if fopen wrappers are set up in your PHP conf):
And this one might fit you the best: http://www.jonasjohn.de/snippets/php/curl-example.htm