Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

CURL Download

DZone's Guide to

CURL Download

·
Free Resource
// 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:

Opinions expressed by DZone contributors are their own.

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

{{ parent.tldr }}

{{ parent.urlSource.name }}