FAQ Database Discussion Community


Dynamically Create Folders and Subfolders

php,google-drive-sdk,google-api-php-client
I have several scripts in php to create a folder and upload a file to the desired folder, but I can't seem to be able to create new folders, new subfolders or create another function to do this process. Do i have to use a parent/children specific procedure? Here's the...

Google Identity Toolkit returns INVALID_CREDENTIALS

php,google-api,google-api-php-client,google-identity-toolkit
I'm currently trying to implement a forgot password feature using the Google Identity Toolkit. The PHP backend is trying to get the oob code because client (iOS) does not have sufficient privileges. Whenever I run the script I get an error of INVALID_CREDENTIALS, more specifically: oob Code: string(249) "{ "error":...

Google API get all logged in accounts

php,google-api-php-client
I'm using Google API Javascript SDK to get access token, then submit the token to server. On server side, I use Google API PHP Client to get user info by access token, if I logged in 3 accounts then I just get information of the first one. How can I...

Gmail API: Get list of messages labelled with a specific label in php

php,email,gmail,google-api-php-client,gmail-api
THE SITUATION I am setting up Gmail API for my app. I need to import all the emails labelled with a specific label, for example TRASH, SPAM, SENT, UNREAD, STARRED etc.. I am able to get the inbox emails list and single message info. And i can get the list...

Gmail API: example of a request to the API

php,google-api,google-oauth,google-api-php-client,gmail-api
I am trying access the Gmail API with my application. I should have done properly all the setup and I am testing a request to the API, in the specific the request to get the messages as read only. My code: public function gmail_get_messages() { $client = new Google_Client(); $client->setApplicationName("Gmail...

Google Drive help required access to own Drive account

google-drive-sdk,google-oauth,google-api-php-client
I want to access my own google drive on web page but allow anyone to upload files and restrict download access or show only limited file to user for downloading. Drive API assumes that I will access another users credentials. But what I want is opposite, anyone can view my...

yii2, google outh2 and scope

php,oauth-2.0,yii2,google-api-php-client,yii2-user
I am using Yii2, GoogleOAuth and yii2-user extension. I want to receive user google circles and set scope to my config: 'authClientCollection' => [ 'class' => 'yii\authclient\Collection', 'clients' => [ 'google' => [ 'class' => 'yii\authclient\clients\GoogleOAuth', 'clientId' => '758709912345-p4qp4lqihit5un1u6qb75msqp5m5j6d8.apps.googleusercontent.com', 'clientSecret' => 'ZygOIi1-0asfktUQ1pKOFOo', 'scope' => 'https://www.googleapis.com/auth/plus.login https://www.googleapis.com/auth/userinfo.email...

Youtube API v3 without the need of End-User Authentication

php,upload,access-token,google-api-php-client,youtube-data-api
Im trying to create a Youtube upload script that does not require the end user to login in order to upload a video to my channel. The issue is I can gain the access token but it expires after an hour of being inactive. Also I am unsure where you...

Unauthorised access to Email Settings Google API

google-api,google-api-php-client
I am using both GAM and the Google API PHP client library to integrate with Google for Work. I am using a service account and I have authorized the Client ID in the Admin console to access the following two scopes: https://www.googleapis.com/auth/drive https://apps-apis.google.com/a/feeds/emailsettings/2.0/ I have also enabled the Drive API...

Google Analytics API from localhost

php,google-analytics,google-api,google-analytics-api,google-api-php-client
Working on a php script to pull data from Google Analytics with the Google PHP Client API. I've got the script set up at localhost/ga/. Got my API keys all set up, Analytics API turned on. In "Client ID for Web application": REDIRECT URIS http://localhost/ga/ JAVASCRIPT ORIGINS http://localhost In "Key...

Filtering Event List Google Calendar PHP

php,calendar,google-calendar,google-api-php-client
I am trying to fetch events that lie between certain user-given dates from a google calendar using the following code segment: form name="dates" method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>"> Start: <input type="date" name="start"> End: <input type="date" name="end"> <br /> <input type="submit" name="submit" value="Anzeigen"> </form> <?php if(isset($_POST['submit'])) { echo "Dates were chosen:...

Google Scripts + Google API PHP

php,google-apps-script,google-api,google-apps,google-api-php-client
I am trying to call one of my Google Scripts from my google-api-php-client and I can't find how to do this. I deployed my app as a web app, and I got the web app url which I can call with curl, but I need to call it as my...

Using google account for private website access

php,google-oauth,google-api-php-client,google-login,google-account
Currently, the person I'm developing for uses google docs to display the website/files. Which can only be accessed via google accounts ending in a certain domain name. For example [email protected] if it's a webtest google account then it can access it. Now I'm creating them a website not linked to...

Google Drive PHP Client render PDF?

php,google-drive-sdk,google-api-php-client
I'm trying to render a PDF from a service account (the file is shared with the service). $pdf = $drive->files->get($file_id); $pdf->downloadUrl However, the resource is coming in with 401 Unauthorized. It's funny that I'm authorized to get the files and everything, but downloading the actual files is unauthorized? I want...

How can I insert data (event) into Google Calendar with PHP?

php,google-calendar,google-oauth,google-api-php-client,service-accounts
I am trying to insert events into Google Calendar, but I get errors everytime. I've been searching for hours to get answer, but I found nothing for my problem. I tested a lot of examples, without success. I'm new in Google Calendar, and I can't really understand the google api...

Silex/Google API

google-api-php-client,silex
I am working on a Silex application, trying to get the Google API PHP client implemented via Composer, and having little luck. I've tried a number of different configurations, including variations in app.php, autoload_namespaces.php, autoload_classmap.php as well as in the Google_Client class itself. I load the library with: "require": {...

Google Drive Service: “Catchable fatal error: Argument 1 passed to Google_DriveService::__construct() must be an instance of Google_Client”

php,google-api-php-client,google-client
So yeah, the error just makes it look like the argument isn't an instance of the Google Drive Service. I've looked up and down for people with similar errors but I've got nothing. Here's the full error and then my code: Catchable fatal error: Argument 1 passed to Google_DriveService::__construct() must...

Gmail API Watch() not working

google-api-php-client,gmail-api
I am following Gmail API Push notifications guide given at https://developers.google.com/gmail/api/guides/push. However, when I try to create a new watch from API explorer, it gives following response: { "error": { "errors": [ { "domain": "global", "reason": "invalidArgument", "message": "Invalid topicName does not match projects/google.com:apisexplorerconsole/topics/*" } ], "code": 400, "message": "Invalid...

Google OAuth 2.0 “error” : “redirect_uri_mismatch”

oauth,google-api-php-client,google-oauth2
I spend already one day, crashed one glass and I am really angry about it, I do not understand what google want from me, and what is wrong. I've enabled Google+ Api in developers console , created new OAuth Client ID $ch = curl_init('https://accounts.google.com/o/oauth2/token');...

Adding google api client to codeigniter

php,codeigniter,google-drive-sdk,google-api-php-client
I want to upload files to google drive using php in codeigniter. First of all i am trying to integrate google api client to codiginator. I have uploaded all the files in to my third_party folder. it look like this I i have created a file called google.php inside my...

Google Groups Directory API - Can't add new member

google-api-php-client,google-groups,google-groups-api
I'm trying to integrate something into our website to add new members to our Google Groups mailing list when they create an account. I'm using the PHP API of the Admin SDK to do so, but have had no luck Here's the code include_once 'autoload.php'; $clientId = 'xxxxxxx.apps.googleusercontent.com'; $serviceAccountName =...

Youtube API V3 and PHP: How to update syndicate option through API

php,youtube-api,google-api-php-client,youtube-data-api,youtube-v3-api
I am using YouTube API V3 and Google API PHP client to upload video. I am not able to find any parameter to update syndicate option which is in advanced settings. In V2 the option is available with the parameter "syndicate" in access controls. But in V3 I am not...

How to get OpenID 2.0 identifiers using Google API PHP Client

google-api-php-client
I'm trying to migrate from OpenID 2.0 to OpenID Connect using the library found at https://github.com/google/google-api-php-client. I've got the example code from the bottom of https://developers.google.com/api-client-library/php/auth/web-app working but I can't figure out how to use the library to get the OpenID 2.0 identifiers. Most of the documentation on Google recommends...

Google PHP API Analytics gives strange userRateLimitExceeded

php,google-analytics,google-api-php-client,quota
Since GAPI stopped working two days ago I had to rewrite some code for my Google Analytics dashboard. I decided to use the Google API PHP Client (https://github.com/google/google-api-php-client) I got it all working pretty nice at my local Vagrant Ubuntu server but when I deploy the code to my remote...

Unable to download closed captions in Youtube API v3

php,youtube-api,google-api-php-client,closed-captions,youtube-api-v3
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 have hosted the example in above link here with my authorization credentials inserted...

Google+ Sign In cross client(android/web) authentication

android,google-api-php-client,google-api-client
i'm trying to integrate 'Log in with Google' in app that have an android and web component. Everything in the web component is working fine with the following steps: 1. Rendering the view with an anti-forgery token, client id and app name. $state = md5(rand()); Session::set('state', $state); $this->view->render('login', array( 'CLIENT_ID'...

Cannot read property 'length' of undefined rarely happening

javascript,jquery,google-analytics-api,google-api-php-client
I've been creating a tool, and needed to create a series of dropdown menus to select a profile/view id (from google analytics) that populates the next menu on change of the previous one (selecting the correct properties for the correct accounts, and then the correct profiles for the correct properties)....

Gmail API: How to get access token?

php,google-api,google-oauth,google-api-php-client,gmail-api
I am testing the Gmail API. So far I have done the following: I have created the project in the Google Developers Console I have enabled the Gmail API. I have created a new Client ID and the client secret. In my PHP script I have installed the PHP Client...

Google Drive API 500 null errors when copying

google-api,google-drive-sdk,google-api-php-client,google-api-client
I'm getting this error message (100% of the time) when copying a shared file, using the latest version of php library. And I'm getting the same response via the API explorer: developers.google.com/drive/v2/reference/files/copy Google_Exception: Error calling POST https://www.googleapis.com/drive/v2/files/#fileid#/copy: (500) { "error": { "code": 500, "message": null } } This issue seem...

Google Analytics API in PHP backend

php,google-api,google-oauth,google-analytics-api,google-api-php-client
So I want to display GA chart in custom PHP backend. So I created APP in https://console.developers.google.com/ but I cant figure out how to access my own google analytics data withouth asking for user to login. For now I have simple code: $client = new Google_Client(); $client->setApplicationName("App Name"); $client->setClientId(CLIENT_ID); $client->setClientSecret(CLIENT_SECRET);...

Generating wrong Uri for PubSub Service

google-api-php-client,google-cloud-pubsub
I am using PHP Client API for Google Pub/Sub and have noticed that whenever I am trying to make a request via PubSub service object, it generates the wrong API uri. E.g. I try to request list of project Topics as follows: $service = new Google_Service_Pubsub($client); $topicsList = $service->projects_topics->listProjectsTopics('projects/my-1'); API...

Is it possible to upload files directly to the Google Cloud Storage?

php,google-cloud-storage,google-api-php-client
I have written a file upload for larger files that is uploading the files to the Cloud Storage. Unfortunately this takes a while, because the Files are uploaded to the web server first, and then again from the web server to the Google Cloud Storage. Is there a way to...

Creating Multiple Custom Attibutes For Product with google-api-php-client

php,google-api,google-api-php-client
According to that answer https://support.google.com/merchants/answer/4588281?hl=en-GB if I want set multiple promotions ids for the product with the API I can specify multiple lines of: <sc:attribute name="promotion_id">PROMOTION_ID</sc:attribute> I am using this lib https://github.com/google/google-api-php-client My question is how can i do it with this library. Should I use custom attributes? for example....

Google php api authentication exception

google-api-php-client
I'm trying to authenticate google service account using Outh2 but keep getting this error - Exception - Error refreshing the OAuth2 token, message: '{ "error" : "access_denied", "error_description" : "Requested client not authorized." }' I have followed every instruction at https://developers.google.com/api-client-library/php/auth/service-accounts I also did authorize the service account from google...

Google Webmaster Tools API

php,google-api-php-client,google-webmaster-tools
I am attempting to pull a list of the companies that my company has registered in their Google Webmaster Tools. I am doing this using PHP and the Google API Client Library for PHP (https://developers.google.com/api-client-library/php/). I have gotten everything going, except for the fact that it gives me an empty...

Google Drive api setting folder parents

php,google-drive-sdk,google-api-php-client
I have been trying to use google api to create first a root folder and then subfolders inside that root folder. However the results have been less than encouraging. Here is the code to create folders: public function createFolder($name, $parents = array()) { /** @var $client \Google_Client */ $client =...

How do I retrieve the list of products from the Google Shopping Content API v2

google-api-php-client
I have to admit to finding it impossible to find some simple code examples to give me a head start into this new Shopping Content API v2. First task: Retrieve a list of products from the API Ish shimple right? Probably, but I can't figure out how it all connects...

Unable to connect to datastore via local php instance

php,google-app-engine,google-api-php-client
I am trying to follow the guide at https://gae-php-tips.appspot.com/2013/12/23/getting-started-with-the-cloud-datastore-on-php-app-engine/ and I am up to the part of running the initial "datastore_connect" query It works when I deploy remotely, but when I run locally I get this error in the browser: Warning: mkdir(): Permission denied in Y:\UMBRELLA\SOCIALIBS\GAE\socialibs\php-libs\external\google-api-php-client-master\src\Google\Cache\File.php on line 140 And...