DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Snippets has posted 5883 posts at DZone. View Full User Profile

CURL Download

04.26.2007
| 14251 views |
  • submit to reddit
        // 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);	

}