You are here

function MCAPI::httpBuildQuery in Mailchimp 7

Same name and namespace in other branches
  1. 5.2 MCAPI.class.php \MCAPI::httpBuildQuery()
  2. 5 MCAPI.class.php \MCAPI::httpBuildQuery()
  3. 6.2 MCAPI.class.php \MCAPI::httpBuildQuery()
  4. 6 MCAPI.class.php \MCAPI::httpBuildQuery()

Re-implement http_build_query for systems that do not already have it

1 call to MCAPI::httpBuildQuery()
MCAPI::callServer in ./MCAPI.class.php
Actually connect to the server and call the requested methods, parsing the result You should never have to call this function manually

File

./MCAPI.class.php, line 1653

Class

MCAPI

Code

function httpBuildQuery($params, $key = null) {
  $ret = array();
  foreach ((array) $params as $name => $val) {
    $name = urlencode($name);
    if ($key !== null) {
      $name = $key . "[" . $name . "]";
    }
    if (is_array($val) || is_object($val)) {
      $ret[] = $this
        ->httpBuildQuery($val, $name);
    }
    elseif ($val !== null) {
      $ret[] = $name . "=" . urlencode($val);
    }
  }
  return implode("&", $ret);
}