I am trying to get a response from MPESA payment API using laravel but I am getting an error . My code is as below

```
namespace App\Http\Controllers;

use Illuminate\Http\Request;

class MPESA_AUTH extends Controller
{
    public function Authorize(){

        $url = 'https://sandbox.safaricom.co.ke/oauth/v1/generate?grant_type=client_credentials';
        $CONSUMER_KEY= 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx';
        $CONSUMER_SECRET= 'xxxxxxxxxxxx';
        $curl = curl_init();
        curl_setopt($curl, CURLOPT_URL, $url);
        $credentials = base64_encode($CONSUMER_KEY,$CONSUMER_SECRET);
        curl_setopt($curl, CURLOPT_HTTPHEADER, array('Authorization: Basic '.$credentials)); //setting a custom header
        curl_setopt($curl, CURLOPT_HEADER, true);
        curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);

        $curl_response = curl_exec($curl);

        $curl_json=json_decode($curl_response);
        return $curl_json;
    }
}

```

The error am getting is as below
[![enter image description here](https://i.stack.imgur.com/nk13N.png)](https://i.stack.imgur.com/nk13N.png)