Error: Call to undefined method GuzzleHttp\Client::request()

Viewed 1055

I have tried importing

use GuzzleHttp;
use GuzzleHttp\Subscriber\Oauth\Oauth1;

but it doesn't work it keeps giving me the same PHP error Fatal error:

Uncaught Error: Call to undefined method GuzzleHttp \ Client :: request ()

in the line where I call the request method

<?php
require_once 'config.php';

try {
    
   $client = new GuzzleHttp\Client(['base_uri' => 'https://zoom.us']);
 
    $response = $client->request('POST', '/oauth/token', [
        "headers" => [
            "Authorization" => "Basic ". base64_encode(CLIENT_ID.':'.CLIENT_SECRET)
        ],
        'form_params' => [
            "grant_type" => "authorization_code",
            "code" => $_GET['code'],
            "redirect_uri" => REDIRECT_URI
        ],
    ]);
 
    $token = json_decode($response->getBody()->getContents(), true);
 
    $db = new DB();
 
    if($db->is_table_empty()) {
        $db->update_access_token(json_encode($token));
        echo "Access token inserted successfully.";
    }
} catch(Exception $e) {
    echo $e->getMessage();
}
?>
0 Answers
Related