title: PHP cURL POST dataset
body: <p>I've been given the following example in order to post data to a API url</p>
  
  <pre><code>curl --request POST \
    --url https://apiurl \
    --header 'auth-token: {{token}}' \
    --header 'content-type: application/json' \
    --data '{
    "user": {
      "email": "my@email.com",
      "name": "James",
      "tel": "0000000"
    }
  }'
  </code></pre>
  
  <p>I got my cURL working using the following code but I need to post the user parameters as above like email, name, tel etc.</p>
  
  <pre><code>$curl = curl_init();
  
  curl_setopt_array($curl, array(
      CURLOPT_URL =&gt; $url,
      CURLOPT_RETURNTRANSFER =&gt; 1,
      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_HTTPHEADER =&gt; array('Cache-Control: no-cache', 'auth-token: '.$token)
  
  ));
  $response = curl_exec($curl);
  curl_close($curl);
  </code></pre>
  
  <p>How can I post the fields as the example states using my code?</p>