title: JSON cURL post comes out as an Empty Array
body: <p>I am posting an array converted to <code>JSON</code> string with <code>cURL</code> like below.
  However on the receiving end, I get an empty array.</p>
  
  <pre><code>function postFunction ($data_h) {
  
      $c = curl_init();
  
      curl_setopt_array($c, array(
              CURLOPT_URL =&gt; 'https://domain.tld/script.php',
              CURLOPT_HTTPHEADER =&gt; array('Content-Type:application/json'),
              CURLOPT_POST =&gt; true,
              CURLOPT_POSTFIELDS =&gt; json_encode($data_h), 
              CURLOPT_RETURNTRANSFER =&gt; true
          ) 
      );
  
      return curl_exec($c);
      curl_close($c);
  }
  
  
  $setup = [
      'sms' =&gt; [
          'number' =&gt; '+39XXXXXXXX',
          'message' =&gt; 'Sample msg 123...',
      ]
  ];
  
  
  print_r( postFunction($setup) );
  </code></pre>
  
  <p>Instead of <code>$_POST</code> I've tried using <code>var_dump($HTTP_RAW_POST_DATA)</code> as I saw on another question on Stack—but all I get with it is a <code>NULL</code>.</p>
  
  <hr>
  
  <p>This is what I get when I return <code>curl_getinfo($c)</code>:</p>
  
  <p>It doesn't even adjust the content type.</p>
  
  <pre><code>Array
  (
      [url] =&gt; https://domain.tld/script.php
      [content_type] =&gt; text/html; charset=utf-8
      [http_code] =&gt; 200
      [header_size] =&gt; 140
      [request_size] =&gt; 593
      [filetime] =&gt; -1
      [ssl_verify_result] =&gt; 0
      [redirect_count] =&gt; 0
      [total_time] =&gt; 0.127732
      [namelookup_time] =&gt; 0.013128
      [connect_time] =&gt; 0.013257
      [pretransfer_time] =&gt; 0.106738
      [size_upload] =&gt; 463
      [size_download] =&gt; 5
      [speed_download] =&gt; 39
      [speed_upload] =&gt; 3624
      [download_content_length] =&gt; -1
      [upload_content_length] =&gt; 0
      [starttransfer_time] =&gt; 0.125601
      [redirect_time] =&gt; 0
      [redirect_url] =&gt; 
      [primary_ip] =&gt; xx.xx.xx.xx
      [certinfo] =&gt; Array
          (
          )
  
  )
  </code></pre>
  
  <p>At the end I want to turn the data into an object with <code>json_decode()</code> however I first need to get the data.</p>
  
  <p>Any thoughts on what I'm doing incorrectly here?</p>