title: How to send array and object with curl
body: <p>I am a beginner with curl. I want to make a request where I post different data.</p>
  
  <p>I have a code</p>
  
  <pre><code>$curl = curl_init();
  
  
  $fields = (object) array(
       'contactFilter' =&gt; (object) array(
            'clicked_message.messageid' =&gt; '5',
            'messages_sent.messageid' =&gt; '5'
        ),
       'exportAttributes' =&gt; 'email',
     );
  
  $fields = json_encode($fields);
  
  $fields_string = http_build_query($fields);
  
  curl_setopt_array($curl, array(
    CURLOPT_URL =&gt; "https://api.sendinblue.com/v3/contacts/export",
    CURLOPT_HTTPHEADER =&gt; array(
      'Accept: application/json',
    'Content-Type: application/json',
    'api-key: my-key-12345',
    ),
    CURLOPT_RETURNTRANSFER =&gt; true,
    CURLOPT_ENCODING =&gt; "",
    CURLOPT_MAXREDIRS =&gt; 10,
    CURLOPT_TIMEOUT =&gt; 30,
    CURLOPT_HTTP_VERSION =&gt; CURL_HTTP_VERSION_1_1,
    CURLOPT_CUSTOMREQUEST =&gt; "POST",
    CURLOPT_POSTFIELDS =&gt; $fields_string
  ));
  
  $response = curl_exec($curl);
  </code></pre>
  
  <p>Documentation says that I need;</p>
  
  <pre><code>contactFilter object (X= campaign id): {"clicked_message.messageid": X,"messages_sent.messageid": X}
  </code></pre>
  
  <p>and </p>
  
  <pre><code>exportAttributes` array of strings For example, `['fname', 'lname, 'email'].
  </code></pre>
  
  <p>how should my request should look like?</p>