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


Php video upload to youtube via youtube data api

我在将视频上传到您的tube时收到以下错误。

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}

在谷歌开发者控制台下面的api是启用

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

应该启用哪个api来解决问题。

如果我们阅读此消息:

API上配置了per-IP或per-Referen限制密钥,并且请求与这些限制不匹配。请使用如果出现以下情况,Google Developers Console将更新您的API密钥配置应该允许来自此IP或referer的请求。

你没有把项目移到另一个主机上,或者你在另一个公司工作吗?正如我所知,谷歌Api提供了一个与你工作的主机相关的Api密钥,所以在你的情况下,你必须重新生成一个新的密钥!