iboldurev / dialogflow

Unofficial php sdk for Dialogflow
https://dialogflow.com/
MIT License
164 stars 60 forks source link

Cant access returned Object property #22

Open hamza-younas94 opened 5 years ago

hamza-younas94 commented 5 years ago

HI i am using an example, i wan to extract the fulfilment and speech for output, i have tried var_dump which is showing object is private and i am unable to access any of property

i.e $response->result->fulfilment;

use DialogFlow\Client;
use DialogFlow\Model\Query;
use DialogFlow\Method\QueryApi;

try {
    $client = new Client('access_token');
    $queryApi = new QueryApi($client);

    $meaning = $queryApi->extractMeaning('Hello', [
        'sessionId' => '1234567890',
        'lang' => 'en',
    ]);
    $response = new Query($meaning);
} catch (\Exception $error) {
    echo $error->getMessage();
}