<?php
require_once "../../vendor/autoload.php";
include  "../RESTAPI.php";

use GuzzleHttp\Client;

try {
   

$client = new Client([
    'base_uri' => $url . $api,
    'handler' => $stack
]);

$response = $client->get( 'products/13', [ 'auth' => 'oauth' ] );

$result = json_decode($response->getBody(), true); // returns an object

echo $response->getBody().'<br>';

echo $result['id'].'<br>';
echo $result['name'].'<br>';
echo $result['slug'].'<br>';
echo $result['date_created'].'<br>';
echo $result['date_modified'].'<br>';
echo $result['date_modified'].'<br>';

//echo $response->getStatusCode().'<br>';
//echo $response->getHeaderLine('content-type').'<br>';
//echo $response->getBody();

} catch (Exception $e) {
    echo $e->getMessage();    
}