note 127785 added to function.curl-setopt

From: Date: Thu, 20 Oct 2022 16:06:53 +0000
Subject: note 127785 added to function.curl-setopt
Groups: php.notes 
Request: Send a blank email to php-notes+get-219735@lists.php.net to get a copy of this message
Apparently, when you use CURLOPT_FILE to direct output to a file instead of STDOUT after handle creation, it automatically sets CURLOPT_RETURNTRANSFER to false. If you try to reuse the handle in such a situation (even with a different file), you may get warning like "CURLOPT_FILE resource has gone away, resetting to default" and content of the previous response will be sent to browser (and seemingly exit the script). To avoid this behavior, you need to CURLOPT_RETURNTRANSFER to true after updating CURLOPT_FILE. If you do want the response from the handle as a string, that is. ---- Server IP: 45.112.84.4 Probable Submitter: 45.91.159.161 (proxied: 2001:14ba:a0f5:ca00:7996:af3b:5c3e:9d90) ---- Manual Page -- https://php.net/manual/en/function.curl-setopt.php Edit -- https://main.php.net/note/edit/127785 Del: integrated -- https://main.php.net/note/delete/127785/integrated Del: useless -- https://main.php.net/note/delete/127785/useless Del: bad code -- https://main.php.net/note/delete/127785/bad+code Del: spam -- https://main.php.net/note/delete/127785/spam Del: non-english -- https://main.php.net/note/delete/127785/non-english Del: in docs -- https://main.php.net/note/delete/127785/in+docs Del: other reasons-- https://main.php.net/note/delete/127785 Reject -- https://main.php.net/note/reject/127785 Search -- https://main.php.net/manage/user-notes.php

« previous php.notes (#219735) next »