Bug #74280 [NEW]: CURLOPT_FILE not work in curl_setopt_array
| From: | luutruong1992 at gmail dot com | Date: | Tue, 21 Mar 2017 09:11:15 +0000 |
| Subject: | Bug #74280 [NEW]: CURLOPT_FILE not work in curl_setopt_array | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-207969@lists.php.net to get a copy of this message | ||
From: luutruong1992 at gmail dot com
Operating system: Linux
PHP version: 5.6.30
Package: cURL related
Bug Type: Bug
Bug description:CURLOPT_FILE not work in curl_setopt_array
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 bug report at https://bugs.php.net/bug.php?id=74280&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=74280&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=74280&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=74280&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=74280&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=74280&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=74280&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=74280&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=74280&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=74280&r=support
Expected behavior: https://bugs.php.net/fix.php?id=74280&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=74280&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=74280&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=74280&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=74280&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=74280&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=74280&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=74280&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=74280&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=74280&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=74280&r=mysqlcfg