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:

The best of DZone straight to your inbox.

SEE AN EXAMPLE
Please provide a valid email address.

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.
Subscribe

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

{{ parent.tldr }}

{{ parent.urlSource.name }}