note 71053 added to function.curl-setopt

From: Date: Thu, 09 Nov 2006 19:27:38 +0000
Subject: note 71053 added to function.curl-setopt
Groups: php.notes 
Request: Send a blank email to php-notes+get-119567@lists.php.net to get a copy of this message
I have seen two posts complaining the "CURLOPT_POSTFIELDS" option is not working well. This was the solution given below: $o=""; foreach ($post_data as $k=>$v) { $o.= "$k=".utf8_encode($v)."&"; } $post_data=substr($o,0,-1); The assumption that this is an error is not true, as stated on http://curl.rtin.bz/docs/httpscripting.html: " The data you send to the server MUST already be properly encoded, curl will not do that for you. For example, if you want the data to contain a space, you need to replace that space with %20 etc. Failing to comply with this will most likely cause your data to be received wrongly and messed up." This means you do really have to encode the data yourself the right way. ---- Server IP: 194.109.193.119 Probable Submitter: 83.160.29.207 ---- Manual Page -- http://www.php.net/manual/en/function.curl-setopt.php Edit -- https://master.php.net/note/edit/71053 Del: integrated -- https://master.php.net/note/delete/71053/integrated Del: useless -- https://master.php.net/note/delete/71053/useless Del: bad code -- https://master.php.net/note/delete/71053/bad+code Del: spam -- https://master.php.net/note/delete/71053/spam Del: non-english -- https://master.php.net/note/delete/71053/non-english Del: in docs -- https://master.php.net/note/delete/71053/in+docs Del: other reasons-- https://master.php.net/note/delete/71053 Reject -- https://master.php.net/note/reject/71053 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#119567) next »