I guess this should work

set_time_limit(0);
$ch = curl_init($siteURL);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, false);
curl_setopt($ch, CURLOPT_BINARYTRANSFER, true);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 0);
curl_setopt($ch, CURLOPT_FILE, 'stream.bin');
curl_exec($ch);

Regards

> From: magda.hasib...@yahoo.co.uk
> To: php-general@lists.php.net
> Date: Tue, 13 Oct 2009 11:01:04 +0700
> Subject: [PHP] How to bypass (pipe) curl_exec return value directly to a file?
> 
> Newbie question.
> I need to download a very large amount of xml data from a site using CURL.
> 
> How to bypass (pipe) curl_exec return value directly to a file, without
> using memory allocation?
> 
> set_time_limit(0);
> $ch = curl_init($siteURL);
> curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
> $mixed = curl_exec($ch);
> 
> How to set/pipe $mixed as a (disk) file, so that data returned by curl_exec
> is directly saved to the disk-file, and not involving memory allocation?
> 
> Thank you.
> 
> -PHP 5
> -Windows XP
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
                                          
_________________________________________________________________
Windows Live: Make it easier for your friends to see what you’re up to on 
Facebook.
http://www.microsoft.com/middleeast/windows/windowslive/see-it-in-action/social-network-basics.aspx?ocid=PID23461::T:WLMTAGL:ON:WL:en-xm:SI_SB_2:092009

Reply via email to