Я пытаюсь отправить запрос на публикацию в API мест Google, используя следующий код PHP, но я получаю сообщение об ошибке
string (141) "{" error_message ":" Для этой службы требуется ключ API."," html_attributions ": []," results ": []," status ":" REQUEST_DENIED "}"
<?php
include_once 'configuration.php';
$url = 'https://maps.googleapis.com/maps/api/place/textsearch/json';
$data = array('query' => 'restaurants in Sydney', 'key' => API_KEY);
$options = array(
'http' => array(
'header' => "Content-type: application/x-www-form-urlencoded\r\n",
'method' => 'POST',
'content' => http_build_query($data)
)
);
$context = stream_context_create($options);
$result = file_get_contents($url, false, $context);
if ($result === FALSE) { /* Handle error */ }
var_dump($result);
В чем проблема?