title: send data array (same key values) using php curl
body: <p>I am sending a list of names and emails.</p>
  
  <p>I am trying to create with curl the same functionality as in this form</p>
  
  <pre><code>&lt;form method="post" action='http://url'&gt;        
      name: &lt;input type="text" name="name" value='name1'&gt;
      email:&lt;input type="text" name="email" value='email1'&gt;
      name: &lt;input type="text" name="name" value='name2'&gt;
      email: &lt;input type="text" name="email" value='email2'&gt;
      &lt;input type="submit" value="Submit"&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>i want to use the same key so i can use django </p>
  
  <pre><code>names = request.POST.getlist('name')
  </code></pre>
  
  <p>to get all the names in a list.</p>
  
  <p>Now i am trying to do the same as in the form with php curl</p>
  
  <pre><code>$ch = curl_init();
  $curlConfig = array(
  CURLOPT_URL            =&gt; "http://url",
  CURLOPT_POST           =&gt; true,
  CURLOPT_RETURNTRANSFER =&gt; true,
  CURLOPT_POSTFIELDS     =&gt; array(
              'name' =&gt; 'name1',
              'email' =&gt; 'name1@email',
              'name' =&gt; 'name2',
              'email' =&gt; 'name2@email',
              ),
  );
  curl_setopt_array($ch, $curlConfig);
  $result = curl_exec($ch);
  print $result;
  curl_close($ch);
  </code></pre>
  
  <p>and it doesnt work, it only get the last 2 values.
  it is because the array is associative and so the last values override the previous ones.</p>