Over a million developers have joined DZone.

CURL Download

·
// function to dowload a $remote file and store as $local file, using curl


function curl_download($remote, $local)	{
	$cp = curl_init($remote);
	$fp = fopen($local, "w");
	
	curl_setopt($cp, CURLOPT_FILE, $fp);
	curl_setopt($cp, CURLOPT_HEADER, 0);
	
	curl_exec($cp);
	curl_close($cp);
	fclose($fp);	

}

Topics:

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}