google-api-php-client

Google API php client: send etag

て烟熏妆下的殇ゞ 提交于 2019-12-06 13:57:26
问题 I'm using the latest Google PHP Client library. How can I send the etag with this library? I've already tried something like this: $opt_params = array( 'etag' => 'F9iA7pnxqNgrkOutjQAa9F2k8HY/mOihMVEDLCvdSVCzwDmYHpSV'); $response = $youtube->channels->listChannels('snippet', array('id' => $channel_id), $opt_params); Thanks! 回答1: This post is a little long (if not too long). If you just need the code scroll down and skip my discussions. Please proceed as you wish. Background I don't know if

Google Reseller Customer Admin User Creation Admin SDK How

左心房为你撑大大i 提交于 2019-12-06 11:00:19
Google Provisioning API is being replaced by Admin SDK. How can I create a Admin User for my Reseller Customer through Directory API programmatically after creating the customer and subscription through the Google Reseller API. Here is my work flow so far. OAuth 2 Access Token is obtained for scopes -- https://www.googleapis.com/auth/apps.order -- https://www.googleapis.com/auth/admin.directory.user Customer is created and subscription is set to flexible Now I like to create the first Admin user for the domain. when i want to insert the admin user for the domain, I get the error API is not

Google Youtube API Insert Comment always returns error response 403 - “Insufficient Permission” - domain “global”

心不动则不痛 提交于 2019-12-06 08:52:49
I followed the docs and code samples from documentation guide i.e., here: https://developers.google.com/youtube/v3/docs/commentThreads/insert But when I execute the script it always returns a response with error code: 403 message: "Insufficient Permission" Here's complete response object: { "error": { "errors": [ { "domain": "global", "reason": "insufficientPermissions", "message": "Insufficient Permission" } ], "code": 403, "message": "Insufficient Permission" } } I spent alot of time in debugging and surfing on internet to find out how to fix the problem but didn't get any resource where I

Unable to download closed captions in Youtube API v3

自作多情 提交于 2019-12-06 08:43:12
问题 Im using the PHP example code given in Youtube API v3 : https://developers.google.com/youtube/v3/docs/captions/download , to download captions from 3rd party, publicly available YouTube videos in my webapp i.e. I have NOT uploaded the content on Youtube. I am able to get access to the list of caption tracks, but unable to download the caption using the caption track ID from the received list. The error that shows up upon attempting to DOWNLOAD is: Error calling GET https:// www.googleapis.com

How to upload a file to Google Drive using Service Account in PHP?

半世苍凉 提交于 2019-12-06 08:06:28
Quickstart: Run a Drive App in PHP seems to be using an outdated version of [google-api-php-client][2], also it doesn't provide example on how to upload a file using Service Account. In my project I'll need to add a file (spreadsheet) using Service Account, add a spreadsheet, share the spreadsheet with another user and add rows to the spreadsheet. I'm able to get an empty list of spreadsheets, but I couldn't figure it out how to upload a file using Service Account. The PHP Class google-api-php-client/examples/spreadsheet.php: <?php use Google\Spreadsheet\DefaultServiceRequest; use Google

Loading google api client library in codeiniter

旧城冷巷雨未停 提交于 2019-12-06 07:47:24
first I copied the Google folder to application/third_party in codeigniter framework. then google.php inside the application/libraries <?php if (!defined('BASEPATH')) exit('No direct script access allowed'); set_include_path(APPPATH . 'third_party/' . PATH_SEPARATOR . get_include_path()); require_once APPPATH . 'third_party/Google/Client.php'; class Google extends Google_Client { function __construct($params = array()) { parent::__construct(); } } and then i have created a controller named googleClass.php <?php class GoogleClass extends CI_Controller { function __construct($params = array()) {

failedPrecondition error when authenticating with service account to Google API

旧时模样 提交于 2019-12-06 06:20:27
问题 I'm trying to fetch a given email from my own inbox (as project owner) using the Google API 2.0.0 RC4 for PHP. I have a project setup, a downloaded authentication file in JSON format and I have enabled the gmail API in the Google Developers Console. But when I run the following code I get a "Bad Request" error with reason "failedPrecondition". Now this leads me to believe that there is something wrong with the access rights, but I can't figure out what I need to do here. Code: <?php require

refreshTokenWithAssertion Permission Denied

此生再无相见时 提交于 2019-12-06 06:05:02
问题 I am trying to use google-api-client in PHP for a project. I got a "permission denied" response while at this statement: $client->getAuth()->refreshTokenWithAssertion(); Google_IO_Exception, Message:Failed to connect to 74.125.193.84: Permission denied File: /home/www/blah.com/restful/libs/Google/IO/Curl.php Line:81 /home/www/blah.com/restful/libs/Google/IO/Abstract.php(125): Google_IO_Curl->executeRequest(Object(Google_Http_Request)) #1 /home/www/blah.com/restful/libs/Google/Auth/OAuth2.php

Downloading file from Google Drive by using Google Picker

巧了我就是萌 提交于 2019-12-06 05:59:13
问题 I'm trying to build a webpage on which user can select an image from Google Drive by using Google Picker and download selected files to my server by using PHP script. I have managed to setup the Picker, and i get fileIDs but when i pass this IDs to my backend and try GET method i get an authentication error. I have spent 2 days working on this and researching, but more I read google official documentation the more confused I am. Can someone tell me, or link me the example how implement this?

Google_Activity must be an instance of Google_ActivityObject

為{幸葍}努か 提交于 2019-12-06 05:01:32
I don't know what is the error of this. I might think as well is in the library of google PHP client can someone help with this. This is my code: $this->client->refreshToken($con[0]->secret); $newtoken = $this->client->getAccessToken(); $this->client->setAccessToken($newtoken); $activityAccess = new Google_Acl(); $activityAccess->setDomainRestricted(true); $object = new Google_ActivityObject(); $originalContent = $object->setOriginalContent('Happy me'); $originalContent = $object->setContent('Happy me'); $originalContent = $object->setObjectType('domain'); $body = explode(".", $args["post"]);