note 108215 added to function.http-build-query
| From: | tarwin at gmail dot com | Date: | Mon, 09 Apr 2012 01:20:54 +0000 |
| Subject: | note 108215 added to function.http-build-query | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-187016@lists.php.net to get a copy of this message | ||
When using 'http_build_query' with an associative array, and then passing this to the end
of a URL when using cURL I was only getting the first parameter through.
For some insane reason it was giving me back:
var1=hello&var2=world
instead of:
var1=hello&var2=world
I took a stupid amount of time to work out what was going wrong, but it was easy to fix with this.
<?php
str_replace('&', '&', http_build_query($myVars));
?>
----
Server IP: 69.147.83.197
Probable Submitter: 67.21.1.50
----
Manual Page -- http://www.php.net/manual/en/function.http-build-query.php
Edit -- https://master.php.net/note/edit/108215
Del: integrated -- https://master.php.net/note/delete/108215/integrated
Del: useless -- https://master.php.net/note/delete/108215/useless
Del: bad code -- https://master.php.net/note/delete/108215/bad+code
Del: spam -- https://master.php.net/note/delete/108215/spam
Del: non-english -- https://master.php.net/note/delete/108215/non-english
Del: in docs -- https://master.php.net/note/delete/108215/in+docs
Del: other reasons-- https://master.php.net/note/delete/108215
Reject -- https://master.php.net/note/reject/108215
Search -- https://master.php.net/manage/user-notes.php