Error 401 while requesting a list of cards with Unirest\Request::get

Hello everyone. Hope you are having a good day so far.
For the last couple of days, I was playing around with Trello API on my PHP website. Basically what I am trying to do is just create a simple form so I could add new cards to the list and create a button that would return the cards in the list.

I have succeeded in adding a new card to the list, although to add a card I wasn’t using Unirest.

I’ve tried to get the list by using:

$query = array(
  'key' => '73xxxxxxxxxxxxxxxae',
  'token' => '2xxxxxxxxxxxxxxxxxxxxxxxxxxxd'

$response = Unirest\Request::get(

 echo '<pre>'; print_r($response);

And it throws me an error: 401 unauthorized permission requested. At this point, I’m not sure what is causing it as I am able to add a new card. Perhaps I have missed some steps. although I’ve tried to find an answer on forums :confused:

If anything the code that works to add the card looks like this:

 $card_name = htmlspecialchars($_POST['title']);
        $card_content = htmlspecialchars($_POST['content']) . "\n";
        $card_content .= htmlspecialchars($_POST['name']) . " (" . htmlspecialchars($_POST['email']) . ")"; 
        $trello_key          = '73xxxxxxxxxxxxxxxae';
        $trello_api_endpoint = '';
        $trello_list_id      = '6xxxxxxxxxxxxf5';
        $trello_member_token = 2xxxxxxxxxxxxxxxxxxxxxxxxxxxd'; 
        $url = '';
        $result = trello_post($url, $fields);

function trello_post($url, $fields)
        $ch = curl_init();
        curl_setopt($ch, CURLOPT_URL, $url);
        curl_setopt($ch, CURLOPT_POSTFIELDS, $fields);
        curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)");
        curl_setopt($ch, CURLOPT_HEADER, 0);    curl_setopt($ch, CURLINFO_HEADER_OUT, true);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
        curl_setopt($ch, CURLOPT_TIMEOUT, 0);
        curl_setopt($ch, CURLOPT_POST, 1);
        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
        $output = curl_exec($ch);
        return json_decode($output);

Could someone help me out a bit here? How can I make the 401 error to go away and how could I get the list of cards?

Thank you in advance :pray: