title: Posting JSON data to API using CURL
body: <p>When I'm posting <code>json</code> data to API using <code>curl</code> - I'm not getting any output. I would like to send email invitation to recipient. </p>
  
  <pre><code>$url_send ="http://api.address.com/SendInvitation?";
  $str_data = json_encode($data);
  
  function sendPostData ($url, $post) {
  
      $ch = curl_init($url);
      curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
      curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
      curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($post));
  
      return curl_exec($ch);
  }
  </code></pre>
  
  <p>And here is <code>JSON</code> <code>$str_data</code></p>
  
  <pre><code>[
      {
          "authorizedKey"  : "abbad35c5c01-xxxx-xxx",
          "senderEmail"    : "myemail@yahoo.com",
          "recipientEmail" : "jaketalledo86@yahoo.com",
          "comment"        : "Invitation",
          "forceDebitCard" : "false"
      }
  ] 
  </code></pre>
  
  <p>And calling function:</p>
  
  <pre><code>$response = sendPostData($url_send, $str_data);
  </code></pre>
  
  <p>This is the API: <a href="https://api.payquicker.com/Help/Api/POST-api-SendInvitation" rel="noreferrer">https://api.payquicker.com/Help/Api/POST-api-SendInvitation</a></p>