所以我试图在php中实现api.ai但是我无法连接到api。我究竟做错了什么?任何帮助表示赞赏。
非官方图书馆我试图使用: https://github.com/iboldurev/api-ai-php
代码:
<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>
错误:
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...)