[wp-hackers] Sending checkbox parameters to a non-PHP script using wp_remote_post

Ryan McCue lists at rotorised.com
Sat Jan 28 12:09:51 UTC 2012

Mike Walsh wrote:
> My question is this - what does the HTTP request look like and can I mimic
> it with wp_remote_post()?  I am not sure how to take the values for my PHP
> array "icecream[]" and configure the parameters for wp_remote_post() so all
> the checked values will be sent to Google which is expecting a parameter
> called "icecream".

The raw HTTP data to the PHP script will look something like:


It sounds like what you'll want for the other API is something like:


To do that, you'll have to create the string yourself and send that as
the 'body' option to wp_remote_post(), as it appears http_build_query()
and family don't handle this (which IIRC, is what WP_Http will use

(If you want to doublecheck any of this, try sending a GET/POST request
to one of the http://httpbin.org/ URLs; they're fantastic for testing with.)

Ryan McCue

More information about the wp-hackers mailing list