Publication de données JSON dans l'API à l'aide de CURL

Quand je poste json de données de l'API à l'aide de curl - je ne suis pas sortie. Je voudrais envoyer une invitation par mail du destinataire.

$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);
}

Et voici JSON $str_data

[
    {
        "authorizedKey"  : "abbad35c5c01-xxxx-xxx",
        "senderEmail"    : "[email protected]",
        "recipientEmail" : "[email protected]",
        "comment"        : "Invitation",
        "forceDebitCard" : "false"
    }
] 

Et de l'appel de la fonction:

$response = sendPostData($url_send, $str_data);

C'est l'API: https://api.payquicker.com/Help/Api/POST-api-SendInvitation

source d'informationauteur ArkNet