google-api-php-client

Error (401) Login Required - Google Calendar API v3

一世执手 提交于 2019-12-12 05:39:09
问题 I want to add an event to a particular Google Apps calendar each time that an appointment is booked in my codeigniter app. So far I've gone through the following steps (from Using OAuth 2.0 for Server to Server Applications): Add Google API Client Library to application/third_party Create Service Account in Developer Console with Google Apps Domain-wide Delegation enabled Store provided .p12 file Authorize Service Account Client ID in Google Apps Admin Console with scope of https://www

Connect Google Calendar API get empty array result with php

旧时模样 提交于 2019-12-12 03:56:10
问题 I'm trying to read my Google Calendar events using PHP and Googles official PHP client library. I created a service account in the Google Developers Console and it seemed to work, I can connect to the calendar but I get an empty array: Google_Service_Calendar_CalendarList Object ( [collection_key:protected] => items [internal_gapi_mappings:protected] => Array ( ) [etag] => [itemsType:protected] => Google_Service_Calendar_CalendarListEntry [itemsDataType:protected] => array [kind] =>

Setting PUT request body with PHP

a 夏天 提交于 2019-12-12 03:43:33
问题 I'm trying to use the Google Sheets API's spreadsheets.values.update (https://developers.google.com/sheets/reference/rest/v4/spreadsheets.values/update) method to insert data into a spreadsheet. I've already acquired a correctly scoped access token, and now I'm trying to send a PUT request via cURL. I'm using the PHP curl wrapper (https://github.com/php-curl-class/php-curl-class) but plain PHP would also be great. Here's what I have so far: $curl = new Curl(); $curl->setHeader("Authorization"

Specify folder name while upload file via Google Drive API

試著忘記壹切 提交于 2019-12-12 03:38:49
问题 Here is my code snippet: $service=new Google_Service_Drive($client); $file=new Google_Service_Drive_DriveFile(); $file->setTitle($title); $file->setDescription('some desciption'); $file->setMimeType($mimeType); $createdFile=$service->files->insert($file,[ 'data' => $data, 'mimeType' => $mimeType, 'uploadType' => 'media' ]); This uploads the file to the root of the google drive. I want to change the upload location to another folder, how can I achieve this? 回答1: never mind i found it myself it

How to Define which Calendar to Connect to using Google Calendar API v3 Service

╄→尐↘猪︶ㄣ 提交于 2019-12-12 03:17:24
问题 I am trying to list all the events in a certain public calendar in a nicely formatted manner on my web page without having a general/public visitor to my web site login or authenticate in any way. I have been doing this since December 2010 using v1 and the Zend Framework. On November 17, 2014 Google deprecated v1 and v2 and now my web page is broken. Here is what I've done so far: created a project in the Google Developer's Console turned on Calendar API installed PHP Client Library on my

Google Analytics PHP API “(403) Insufficient Permission”

倖福魔咒の 提交于 2019-12-11 22:56:40
问题 Ok So as the title suggest Google Analytics API Problems... Now before i start and some one pipes up Duplicate.... i have read though 403 Insufficient permissions error while trying to get Google Analytics data Analytics Google API Error 403: "User does not have any Google Analytics Account" Google Analytics API: "User does not have sufficient permissions for this account." And still unable to get it to work. I have the scope added like so: $client->addScope("https://www.googleapis.com/auth

Using Google Directory API to fetch all users in a domain

不羁的心 提交于 2019-12-11 19:26:15
问题 I am building an app for the Google Marketplace and just made the switch to OAuth 2.0 from 1.0 before final deployment. Before the switch, I was able to use the provisioning API to fetch users in a domain that has installed the app given, appropriate permissions have been granted. My experience with the Directory API (the OAuth 2 counterpart) requires that i perform a 2-legged OAuth to get an access token which I then uses to perform the Admin action. This only works if the access token

How i can use importRows Fusion Data Table in my project? [duplicate]

十年热恋 提交于 2019-12-11 16:21:49
问题 This question already has an answer here : Google PHP API Client & Fusion Tables: How to use importRows? (1 answer) Closed last year . I have this code: $out = fopen('php://output', 'w'); fputcsv($out, array('Location') ); foreach($objects as $object){ fputcsv($out, array( $ad->objectLat.",".$ad->objectLnt, ) ); } $test = fclose($out); $client = new Google_Client(); $client->useApplicationDefaultCredentials(); $client->setScopes('https://www.googleapis.com/auth/fusiontables'); $service = new

google people api: assign/create contact group

天大地大妈咪最大 提交于 2019-12-11 14:11:52
问题 I cannot figure out how to create a new contact group and assign it to the contact using google people api in php. An error "person.memberships is a read only field." occurs at $person->setMemberships(): $contactGroup=new Google_Service_PeopleService_ContactGroup(); //$contactGroup->setGroupType('USER_CONTACT_GROUP'); $contactGroup->setName('Some group'); $contactGroup->create(); $cgm=new Google_Service_PeopleService_ContactGroupMembership(); $cgm->setContactGroupId('groupID'); $membership

Google API - request for token from Oauth2 returns null token

↘锁芯ラ 提交于 2019-12-11 13:51:57
问题 For credentials, I have created an developer account on https://console.developers.google.com, I have created a project and then i have created credentials from API Manager. I use "google/apiclient": "1.1.*" package. I think it is a problem with credentials. $OAUTH2_CLIENT_ID = 'XXXXX-rvm1l9b1nvht9je1ic0bbe05ab5gvhbg.apps.googleusercontent.com'; $OAUTH2_CLIENT_SECRET = 'XXXXXXP90L_DLD3Nrc_rT4zGD'; $client = new Google_Client(); $client->setClientId($OAUTH2_CLIENT_ID); $client->setClientSecret