google-api-php-client

Issue with Google-API-PHP Client, getting error when running the quick start script

老子叫甜甜 提交于 2019-11-29 10:47:29
I am facing an issue with quickstart php script here: https://developers.google.com/drive/v2/web/quickstart/php When I run the script first time, it executes perfectly and the access token is stored in a file called: drive-php-quickstart.json When I run the script second time, it gives me the error: Error start: Notice: Undefined index: expires_in in \google-api-php-client\src\Google\Client.php on line 485 Fatal error: Uncaught exception 'LogicException' with message 'refresh token must be passed in or set as part of setAccessToken' in Error end: My assumption is that access token been saved

Google Calendar API batch request PHP

…衆ロ難τιáo~ 提交于 2019-11-29 08:32:17
i am trying to send a bunch of events via an Batch Request to Google Calendar. But i cant figur out how to do. https://developers.google.com/google-apps/calendar/batch doesnt help me. require_once 'google-api-php-client/src/Google_Client.php'; require_once 'google-api-php-client/src/contrib/Google_CalendarService.php'; $client = new Google_Client(); $client->setUseBatch(true); $batch = new Google_BatchRequest(); $uri = 'http://www.google.com/calendar/feeds/default/private/full/batch'; $batchContent = file_get_contents('xxxxx/google-api-php-client/batch.xml'); $batch->add($batchContent); batch

Uploading video to Youtube using Youtube Data API V3 and Google API Client PHP — getting 401 (unauthorized) message

百般思念 提交于 2019-11-29 05:20:01
I have to implement a way to upload video from our site to youtube. I already registered the app in Google Cloud and got all the necessary client ID, client secret code, browser key, redirect uri and server key. I also did turn ON the Youtube Data API V3, Google+ API, Freebase API and YouTube Analytics API as suggessted by various sites. Here is my code below: require_once 'google-api-php-client/src/Google_Client.php'; require_once 'google-api-php-client/src/contrib/Google_YouTubeService.php'; $client = new Google_Client(); $client->setApplicationName('Application Name'); $client->setClientId(

Post large video to youtube via google php client api v3

∥☆過路亽.° 提交于 2019-11-29 05:09:54
I am trying to upload large videos to youtube via the latest version of the google client api (v3, latest checked out source) I have it posting the videos, but the only way I can get it to work is by reading the entire video into a string, and then passing it via the data parameter. I certainly do not want to read gigantic files into memory, but the api seems to offer no other way to do this. It seems to expect a string as the data parameter. Below is the code I'm using to post the video. $snippet = new Google_VideoSnippet(); $snippet->setTitle("Test title2"); $snippet->setDescription("Test

Create Simple Google Calendar Event in PHP

99封情书 提交于 2019-11-29 04:55:10
I'm having a heck of a time trying to get a very simple event added to a calendar using the Google Calendar API, and I would love it if someone could point out my (probably obvious) issue. I'm using code that I found here . I've put the code in the "google-api-php-client/examples.calendar" directory, where a simple example can be found. <?php require_once '../../src/Google_Client.php'; require_once '../../src/contrib/Google_CalendarService.php'; session_start(); $client = new Google_Client(); $client->setApplicationName("Google Calendar PHP Starter Application"); $client->setClientId('');

Use OAuth Refresh Token to Obtain New Access Token - Google API

二次信任 提交于 2019-11-29 03:55:50
My app is simple, it connects to the Google+ API to authenticate the user, and if successful, it retrieves the user's email and then performs a series of operations on a given database based on the email retrieved. My main issue is that every hour, my access token expires, and I seem not to know how to "refresh" it. I get the following error, which I imagine is expected: The OAuth 2.0 access token has expired, and a refresh token is not available. I am currently storing the access token on a database, and I can therefore retrieve if needed. My only question is how do I use that token to gain a

Use service account to verify Google InAppPurchase

杀马特。学长 韩版系。学妹 提交于 2019-11-28 23:20:15
I've tried so many things in the last days but now I'm out of ideas :( I want to verify an inAppPurchase that has been made in my android app. 1) I created a new service account in the google API console. 1a) The service account is listed unter permissions and has "can view" permission 2) I'm using the most current version of https://github.com/google/google-api-php-client 3) code snippet from my PHP script: $client = new Google_Client(); $client->setApplicationName('myAppName' ); $client->setClientId('123456789123-vxoasdt8qwe6awerc9ysdfmjysdfysf64werweria8fh.apps.googleusercontent.com'); $key

Get Userinfo from Google OAuth 2.0 PHP API

一曲冷凌霜 提交于 2019-11-28 22:52:48
I am trying to use Google Oauth API to get userinfo. It works perfectly for Google Plus API but I am trying to create a backup in case the user doesn't have google plus account. The authentication process is correct and I even get the $userinfo object but how exactly do I access the properties. I tried $userinfo->get() but it only return the id of the user. Am I doing something wrong? Here is the code that I am using... require_once '../../src/Google_Client.php'; require_once '../../src/contrib/Google_Oauth2Service.php'; session_start(); $client = new Google_Client(); $client-

Google API PHP offline access, “invalid_grant: Code was already redeemed”

风流意气都作罢 提交于 2019-11-28 20:28:54
问题 How to authorize a Google Client permanently until the user revokes authorization? I am trying to make an app that connects to Google Calendar. It has to run in PHP and therefore I am using the Google API PHP client provided by google. The app needs to have offline access so it works when the user is not in the session. The app is intended to let the user to manage and display his calendars publicly on websites and such. I have created credentials in Google Console, using service method (with

Google Analytics API V3 - HTTP Error: Unable to connect on live server (localhost works fine)

送分小仙女□ 提交于 2019-11-28 11:39:11
问题 (I am using the latest version of this library: https://github.com/google/google-api-php-client) In short, my script works perfectly on localhost, but whenever I upload to our production or staging environments it fails. I am now using a really simple test script from this tutorial: http://blog.salteh.net/2012/10/google-analytics-api-and-service-accounts/ Again, this works perfectly on localhost, but errors on our production and staging servers. The error is: HTTP Error: Unable to connect