Bug #72037 [Opn->Fbk]: for refuse load all of file in memeory

From: Date: Sat, 16 Apr 2016 09:12:14 +0000
Subject: Bug #72037 [Opn->Fbk]: for refuse load all of file in memeory
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-200587@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=72037&edit=1 ID: 72037 Updated by: requinix@php.net Reported by: mojtaba dot khani at yahoo dot com Summary: for refuse load all of file in memeory -Status: Open +Status: Feedback Type: Bug Package: cURL related Operating System: freebsd PHP Version: 5.5Git-2016-04-16 (snap) Block user comment: N Private report: N New Comment: Not enough information was provided for us to be able to handle this bug. Please re-read the instructions at http://bugs.php.net/how-to-report.php If you can provide more information, feel free to add it to this bug and change the status back to "Open". Thank you for your interest in PHP. Additionally, PHP 5.5 is only receiving security fixes, so make sure you test in PHP 5.6 or 7. Previous Comments: ------------------------------------------------------------------------ [2016-04-16 09:07:42] mojtaba dot khani at yahoo dot com Description: ------------ PHP 5.5.30 (cgi-fcgi) Test script: --------------- ini_set('memory_limit', '-1');//no limit for update file on download. $fp= fopen("$base.tmp", "wb"); $para=[CURLOPT_FILE=> $fp, CURLOPT_BINARYTRANSFER=> FALSE, CURLOPT_FOLLOWLOCATION=>true , CURLOPT_RETURNTRANSFER=> FALSE, CURLOPT_CONNECTTIMEOUT=> 10 ]; if(!empty($config['update_config']['max_recv_speed'])) $para[CURLOPT_MAX_RECV_SPEED_LARGE]= intval($config['update_config']['max_recv_speed'])*1024; $o=CallAPI("GET",$url,FALSE,$para); fclose($fp); ----------------------------------------------------------------------- function CallAPI($method, $url, $data = false,$para=[]) { $curl = curl_init(); switch ($method) { case "POST": curl_setopt($curl, CURLOPT_POST, 1); curl_setopt($curl, CURLOPT_HTTPHEADER, array( 'Expect:' ) ); if ($data) curl_setopt($curl, CURLOPT_POSTFIELDS, $data); break; case "PUT": curl_setopt($curl, CURLOPT_PUT, 1); break; default: if ($data) $url = sprintf("%s?%s", $url, http_build_query($data)); } // Optional Authentication: // curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC); // curl_setopt($curl, CURLOPT_USERPWD, "username:password"); //progress if(function_exists("progress")){ curl_setopt($curl, CURLOPT_PROGRESSFUNCTION, 'progress'); curl_setopt($curl, CURLOPT_NOPROGRESS, false); } curl_setopt($curl, CURLOPT_URL, $url); if(!empty($para)){ foreach ($para as $k=>$v) curl_setopt($curl,$k,$v); } if(empty($para[CURLOPT_RETURNTRANSFER])) curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); $result = curl_exec($curl); curl_close($curl); return $result; } ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=72037&edit=1

« previous php.bugs (#200587) next »