note 71053 deleted from function.curl-setopt by danbrown

From: Date: Sun, 17 May 2009 17:28:32 +0000
Subject: note 71053 deleted from function.curl-setopt by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-154987@lists.php.net to get a copy of this message
Note Submitter: jochem AT hotmail dot com ---- 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.

« previous php.notes (#154987) next »