Php 通过 youtube 数据将视频上传到 youtube api

Php video upload to youtube via youtube data api

我在将视频上传到你管时出现以下错误。

exception 'Google_ServiceException' with message 'Error calling POST
https://www.googleapis.com/upload/youtube/v3/videos?part=snippet%2Cstatus&uploadType=multipart&key=AIzaSyCfF7aL8R9qBbXTfl-TkdwcypMfWtPbtOI:
(403) There is a per-IP or per-Referer restriction configured on your
API key and the request does not match these restrictions. Please use
the Google Developers Console to update your API key configuration if
request from this IP or referer should be allowed.' in
/home/acealgos/public_html/demo/maid/app/webroot/youtube_upload/google-api-php-client/src/io/Google_REST.php:66
Stack trace: #0
/home/acealgos/public_html/demo/maid/app/webroot/youtube_upload/google-api-php-client/src/io/Google_REST.php(36):
Google_REST::decodeHttpResponse(Object(Google_HttpRequest)) #1/home/acealgos/public_html/demo/maid/app/webroot/youtube_upload/google-api-php-client/src/service/Google_ServiceResource.php(186):
Google_REST::execute(Object(Google_HttpRequest)) #2
/home/acealgos/public_html/demo/maid/app/webroot/youtube_upload/google-api-php-client/src/contrib/Google_YouTubeService.php(887):
Google_ServiceResource->__call('insert', Array) #3 /home/acealgos/public_html/demo/maid/app/webroot/youtube_upload/index.php(73):
Google_VideosServiceResource->insert('snippet,status',
Object(Google_Video), Array) #4 {main}

在 google 开发者控制台中 api 已启用

BigQuery API        
Debuglet Controller API     
Google Cloud SQL            
Google Cloud Storage JSON API           
YouTube Analytics API           
YouTube Data API v3

应该启用 api 来解决问题。

如果我们读到这条信息:

There is a per-IP or per-Referer restriction configured on your API key and the request does not match these restrictions. Please use the Google Developers Console to update your API key configuration if request from this IP or referer should be allowed.

你有没有把项目转移到另一个主机上,或者你在另一个公司工作,据我所知google Api 给出了一个与你的主机相关的 api 密钥正在工作,所以在你的情况下,你必须去重新生成一个更新的密钥!