So I'm trying to implement api.ai in php however I can't connect to the api. What am I doing wrong? Any help is appreciated.
Unofficial library Im trying to use: https://github.com/iboldurev/api-ai-php
code:
<html>
<head>yoyo</head>
<body>
<?php
require_once __DIR__.'/vendor/autoload.php';
use ApiAi\Client;
try {
$client = new Client('api-key-client');
$query = $client->get('query', [
'query' => 'Hello',
]);
$response = json_decode((string) $query->getBody(), true);
} catch (\Exception $error) {
echo $error->getMessage();
}
?>
</body>
</html>
Error:
Client error: GET https://api.api.ai/v1/query?v=20150910&lang=en&query=Hello resulted in a 400 Bad Request response: { "id": "fb610ed1-6bdd-48cc-ae02-7cd20c3983dd", "timestamp": "2017-01- 03T19:51:45.166Z", "status": { "code": 4 (truncated...)