Mega Code Archive

 
Categories / Php / Strings
 

Writing a response body to a file with cURL

<?php $fh = fopen('local-copy-of-files.html','w') or die($php_errormsg); $c = curl_init('http://www.example.com/files.html'); curl_setopt($c, CURLOPT_FILE, $fh); curl_exec($c); curl_close($c); ?>