Answer the question
In order to leave comments, you need to log in
PHP + cURL file saving?
There is a page that generates and gives the file through the header:
header("Content-type: text/plain");
header("Content-Disposition: attachment; filename=file.txt");
$source = "example.com/file.php";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $source);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$data = curl_exec ($ch);
$error = curl_error($ch);
curl_close ($ch);
var_dump($error);
$destination = "/var/fn/file.txt";
file_put_contents($destination,$data);
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question