1

У меня ошибка при использовании API Youtube v3 (The request did not specify any referer. Please ensure that the client is sending referer or use the API Console to remove the referer restrictions)

Вот мой код. Как передать $headers ?

$DEVELOPER_KEY = $api;
$client = new Google_Client();
$client->setDeveloperKey($DEVELOPER_KEY);
$headers = array('Referer' => 'mysite.com');
$youtube = new Google_Service_YouTube($client);
$searchResponse = $youtube->search->listSearch('id,snippet', array(
    'q' => $query,
    'maxResults' => $count,
    'type' => 'video'
));
1
  • Кто такой рефер? Наверное нужно http.
    – nick_n_a
    4 июн 2018 в 12:50

1 ответ 1

0

Причина не выявлена. Ограничение по домену работали не корректно. Поставил ограничние по IP в настройках API и все заработало.

Ваш ответ

By clicking “Отправить ответ”, you agree to our terms of service and acknowledge you have read our privacy policy.

Всё ещё ищете ответ? Посмотрите другие вопросы с метками или задайте свой вопрос.