note 108162 added to function.curl-setopt

From: Date: Tue, 03 Apr 2012 15:55:07 +0000
Subject: note 108162 added to function.curl-setopt
Groups: php.notes 
Request: Send a blank email to php-notes+get-186952@lists.php.net to get a copy of this message
This may be not obvious, but if you specify the CURLOPT_POSTFIELDS and don't specify the CURLOPT_POST - it will still send POST, not GET (as you might think - since GET is default). So the line: curl_setopt($ch, CURLOPT_POSTFIELDS, $data); is synonym to: curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $data); Even if you set the options like this (in this order): curl_setopt($ch, CURLOPT_POST, 0); curl_setopt($ch, CURLOPT_POSTFIELDS, $data); it will send POST, since CURLOPT_POSTFIELDS is latter. So if you want GET - make sure you don't have CURLOPT_POSTFIELDS specified somewhere. ---- Server IP: 69.147.83.197 Probable Submitter: 195.191.214.110 ---- Manual Page -- http://www.php.net/manual/en/function.curl-setopt.php Edit -- https://master.php.net/note/edit/108162 Del: integrated -- https://master.php.net/note/delete/108162/integrated Del: useless -- https://master.php.net/note/delete/108162/useless Del: bad code -- https://master.php.net/note/delete/108162/bad+code Del: spam -- https://master.php.net/note/delete/108162/spam Del: non-english -- https://master.php.net/note/delete/108162/non-english Del: in docs -- https://master.php.net/note/delete/108162/in+docs Del: other reasons-- https://master.php.net/note/delete/108162 Reject -- https://master.php.net/note/reject/108162 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#186952) next »