Bug #74280 [Opn->Nab]: CURLOPT_FILE not work in curl_setopt_array

From: Date: Tue, 21 Mar 2017 11:30:57 +0000
Subject: Bug #74280 [Opn->Nab]: CURLOPT_FILE not work in curl_setopt_array
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-207971@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=74280&edit=1 ID: 74280 Updated by: requinix@php.net Reported by: luutruong1992 at gmail dot com Summary: CURLOPT_FILE not work in curl_setopt_array -Status: Open +Status: Not a bug Type: Bug Package: cURL related Operating System: Linux PHP Version: 5.6.30 Block user comment: N Private report: N New Comment: CURLOPT_FILE (output goes to a file) and CURLOPT_RETURNTRANSFER (output goes to a string) are mutually exclusive. Previous Comments: ------------------------------------------------------------------------ [2017-03-21 09:11:11] luutruong1992 at gmail dot com Description: ------------ I have try to downloading an file from remote URL but the file was empty while i using this code. $url = 'http://some_url...'; $tempFile = 'output_file.data'; $fp = fopen($tempFile, 'w+'); $options = [ CURLOPT_URL => $url, CURLOPT_FILE => $fp, CURLOPT_FOLLOWLOCATION => 1, CURLOPT_RETURNTRANSFER => 1 ]; $ch = curl_init(); curl_setopt_array($ch, $options); curl_exec($ch); curl_close($ch); fclose($fp); ?> But when I split CURLOPT_FILE to another method. curl_setopt($ch, CURLOPT_FILE, $fp); it is working property. ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=74280&edit=1

« previous php.bugs (#207971) next »