title: PHP - can't get associative array's structure right
body: <p>I try to send a request to an API (mailchimp) using cURL. It works with GET, however, I have problems converting the GET-URl into a proper associative PHP array to send via POST. <em>EDIT</em> Because as MarcB commented, GET requests have some negative sides, like a lenght limit, etc.</p>
  
  <p><em>Please note that I replaced the values of the variables with asteriks (*</em>).<br>
  This is the working GET-parameter:</p>
  
  <pre><code>https://us3.api.mailchimp.com/2.0/ecomm/order-add.json?apikey=***
  &amp;order[id]=***
  &amp;order[campaign_id]=***
  &amp;order[email_id]=***
  &amp;order[total]=***
  &amp;order[store_id]=***
  &amp;order[items][0][product_id]=***
  &amp;order[items][0][category_id]=***
  &amp;order[items][0][category_name]=***
  &amp;order[items][1][product_id]=***
  &amp;order[items][1][category_id]=***
  &amp;order[items][1][category_name]=***
  ...
  </code></pre>
  
  <p><br>
  This is the PHP array for the POST request:</p>
  
  <pre><code>Array
  (
      [apikey] =&gt; ***
      [order] =&gt; Array
          (
              [id] =&gt; ***
              [campaign_id] =&gt; ***
              [email_id] =&gt; ***
              [total] =&gt; ***
              [order_date] =&gt; ***
              [shipping] =&gt; ***
              [tax] =&gt; ***
              [store_id] =&gt; ***
              [store_name] =&gt; ***
              [items] =&gt; Array
                  (
                      [0] =&gt; Array
                          (
                              [product_id] =&gt; ***
                              [category_id] =&gt; ***
                              [category_name] =&gt; ***
                          )
  
                      [1] =&gt; Array
                          (
                              [product_id] =&gt; ***
                              [category_id] =&gt; ***
                              [category_name] =&gt; ***
                          )
  
                      ...
  
                  )
  
          )
  
  )
  </code></pre>
  
  <p><br>
  Response is:</p>
  
  <pre><code>Validation error: {\"order\":\"Please enter a struct\\\/associative array\"}
  </code></pre>
  
  <p><br> Any idea, what I am missing here? Isn't the structure here the same?</p>
  
  <p>--<br>
  <em>UPDATE</em>:
  <br />
  This is the curl code:</p>
  
  <pre><code>function httpPost($url,$params)
  {
    $postData = '';
     //create name value pairs seperated by &amp;
     foreach($params as $k =&gt; $v) 
     { 
        $postData .= $k . '='.$v.'&amp;'; 
     }
     rtrim($postData, '&amp;');
  
      $ch = curl_init();  
  
      curl_setopt($ch,CURLOPT_URL,$url);
      curl_setopt($ch,CURLOPT_RETURNTRANSFER,true);
      curl_setopt($ch,CURLOPT_HEADER, false); 
      curl_setopt($ch, CURLOPT_POST, count($postData));
      curl_setopt($ch, CURLOPT_POSTFIELDS, $postData);    
  
      $output=curl_exec($ch);
      $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
  
      curl_close($ch);
      return array($output, $httpCode);
  
  }
  
  print_r( httpPost( $mc_api_url, $curl_data ) );
  </code></pre>