title: cURL, how to add this specific parameter?
body: <p>I have to create a PHP script that will create new contact in my sendinblue database. Sendinblue has an API that includes a PHP code generator to accomplish this. The documentation is located at: <a href="https://developers.sendinblue.com/reference#createcontact" rel="nofollow noreferrer">https://developers.sendinblue.com/reference#createcontact</a></p>
  
  <p>This is the code I have:</p>
  
  <pre><code>&lt;?php
  $curl = curl_init();
  curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
  curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
  curl_setopt_array($curl, array(
      CURLOPT_URL =&gt; "https://api.sendinblue.com/v3/contacts",
      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; "{\"email\":\"testCreateContact@test.com\",\"emailBlacklisted\":true,\"smsBlacklisted\":false,\"listIds\":[2],\"updateEnabled\":true}",
      CURLOPT_HTTPHEADER =&gt; array(
          "accept: application/json",
          "api-key: *****",
          "content-type: application/json"
      ),
  ));
  $response = curl_exec($curl);
  $err = curl_error($curl);
  curl_close($curl);
  if ($err) {
      echo "cURL Error #:" . $err;
  } else {
      echo $response;
  }
  </code></pre>
  
  <p>Now im looking for how to send the <code>attributes</code> field with the POST request, because you can't add <code>attributes</code> in the code creator on the documentation page:<a href="https://i.stack.imgur.com/xsi80.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/xsi80.png" alt="enter image description here"></a></p>
  
  <p>So I don't understand the syntax to include the <code>attributes</code> field in my code. Thanks!</p>
  
  <p>EDIT :
  So now ive tried this part of code : </p>
  
  <pre><code>curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
  
  
  curl_setopt($curl, CURLOPT_URL, "https://api.sendinblue.com/v3/contacts");
  curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
  curl_setopt($curl, CURLOPT_ENCODING, "");
  curl_setopt($curl, CURLOPT_MAXREDIRS, 10);
  curl_setopt($curl, CURLOPT_TIMEOUT, 30);
  curl_setopt($curl, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);
  curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "POST");
  curl_setopt($curl, CURLOPT_POSTFIELDS, [
      'email' =&gt; 'testCreateContact@test.com',
      'emailBlacklisted' =&gt; true,
      'smsBlacklisted' =&gt; false,
      'listIds' =&gt; [2],
      'updateEnabled' =&gt; true,
      'attributes' =&gt; json_encode([
          "FNAME" =&gt; "Elly",  //ERROR LINE
          "LNAME" =&gt; "Roger",
      ]),
    ]);
  
  curl_setopt($curl, CURLOPT_HTTPHEADER, array(
      "accept: application/json",
      "api-key: ****",
      "content-type: application/json"
    ));
  </code></pre>
  
  <p>But it still don't work, ive got this error : 
  <code>Array to string conversion</code> 
  + this one :
  <code>{"error":{"status":400,"message":"Input must be a valid JSON object","code":"bad_request"}}</code></p>
  
  <p>The documentation say that attributes must be an object so i really don't know how to do this. The documentation is really good, but they missed something here... (no exemple)</p>