RE: [PHP] How to bypass (pipe) curl_exec return value directly to a file?

From: Date: Tue, 13 Oct 2009 08:33:24 +0000
Subject: RE: [PHP] How to bypass (pipe) curl_exec return value directly to a file?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-298881@lists.php.net to get a copy of this message
> $ch = curl_init($url); > $fp = fopen('/tmp/curl.out', 'w'); > curl_setopt($ch, CURLOPT_FILE, $fp); > curl_exec($ch); > > Error checking etc. is of course left up to you. :) oops, I sent directly the file name. Let me reformulate the code then: set_time_limit(0); $fp = fopen('stream.bin', 'wb'); $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, $fp); curl_exec($ch); fclose($fp); Apologize I did not test it before. Regards _________________________________________________________________ Windows Live: Friends get your Flickr, Yelp, and Digg updates when they e-mail you. 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_3:092010

« previous php.general (#298881) next »