note 128365 added to function.curl-setopt

From: Date: Tue, 04 Apr 2023 11:44:41 +0000
Subject: note 128365 added to function.curl-setopt
Groups: php.notes 
Request: Send a blank email to php-notes+get-220323@lists.php.net to get a copy of this message
Set order when using CURLOPT_POST and CURLOPT_POSTFIELDS *matters*. Setting CURL_POST to true will ERASE any previous CURLOPT_POSTFIELDS using an array. Result is request be a POST with empty body. CURLOPT_POSTFIELDS will set CURLOPT_POST to true for you, no need for repeat. If you really need to set both, then either: - set CURLOPT_POST *before* CURLOPT_POSTFIELDS - or don't use array and convert CURLOPT_POSTFIELDS to URL-encoded string, it will not be affected this way (ie. <?php curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($yourArray)); ?> ) ---- Server IP: 45.112.84.4 Probable Submitter: 80.90.13.130 (proxied: 82.62.6.118) ---- Manual Page -- https://php.net/manual/en/function.curl-setopt.php Edit -- https://main.php.net/note/edit/128365 Del: integrated -- https://main.php.net/note/delete/128365/integrated Del: useless -- https://main.php.net/note/delete/128365/useless Del: bad code -- https://main.php.net/note/delete/128365/bad+code Del: spam -- https://main.php.net/note/delete/128365/spam Del: non-english -- https://main.php.net/note/delete/128365/non-english Del: in docs -- https://main.php.net/note/delete/128365/in+docs Del: other reasons-- https://main.php.net/note/delete/128365 Reject -- https://main.php.net/note/reject/128365 Search -- https://main.php.net/manage/user-notes.php

« previous php.notes (#220323) next »