Inviting people with Trello API
<p>i'm trying to invite a person via email to Trello from my website. Here is the <a href="https://developers.trello.com/advanced-reference/organization#put-1-organizations-idorg-or-name-members" rel="nofollow">API reference</a>. When I try to invite him, the plain reply is "invalid key". Here is my function:</p>

<pre><code>public function inviteEmployeeToTrello ($email, $name, $isAdmin)
{
    $organazationTrelloID = 'myOrganazationID';
    $trelloAuthToken = 'myTrelloAuthToken';
    $trelloInviteUrl = 'https://trello.com/1/organizations/'.$organazationTrelloID.'/members';

    if ($isAdmin == 1)
    {
        $type = 'admin';
    }
    else
    {
        $type = 'normal';
    }

    $fields = array(
        'fullName' =&gt; $name,
        'email' =&gt; $email,
        'type' =&gt; $type,
        'token' =&gt; $trelloAuthToken
    );

    // open connection
    $ch = curl_init();

    // set the url, number of PUT vars, PUT data
    curl_setopt($ch, CURLOPT_URL, $trelloInviteUrl);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "PUT");
    curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($fields));

    // exec
    $replyRaw = curl_exec($ch);
    $reply = json_decode($replyRaw, true);

    // close connection
    curl_close($ch);

    dd($ch);
}
</code></pre>