title: Posting multidimensional array with PHP and CURL
body: <p>I'm having trouble posting form data via CURL to a receiving PHP script located on a different host.</p>
  
  <p>I get an <code>Array to string conversion</code> error</p>
  
  <p>This is <code>print_r</code> of the array I'm posting:</p>
  
  <pre><code>Array
  (
      [name] =&gt; Array
      (
          [0] =&gt; Jason
          [1] =&gt; Mary
          [2] =&gt; Lucy
      )
      [id] =&gt; 12
      [status] =&gt; local
      [file] =&gt; @/test.txt
  )
  </code></pre>
  
  <p>This is the line the error occurs on:</p>
  
  <pre><code>curl_setopt($this-&gt;ch, CURLOPT_POSTFIELDS, $post);
  </code></pre>
  
  <p>The third argument <strong>must</strong> be an array because I need the <code>Content-Type</code> header to be set to <code>multipart/form-data</code> as I am sending a file via this same array, therefore I cannot convert the array to a query string or use <code>http_build_query()</code>.</p>
  
  <p>Also I do not have access to the code on the receiving host so I cannot serialize and unserialize the array.</p>
  
  <p>I'm assuming that the value of the <em>name</em> key being an array is the cause for this error, I'm also assuming that <code>CURLOPT_POSTFIELDS</code> doesn't support multidimensional arrays. Is there any other way around this or am I doomed?</p>
  
  <p>Thanks in advance!</p>