google-api-php-client

send email using gmail-api and google-api-php-client

北慕城南 提交于 2019-12-01 12:47:04
I am using https://github.com/google/google-api-php-client and I want to send a test email with a user's authorized gmail account. This is what I have so far: $msg = new Google_Service_Gmail_Message(); $msg->setRaw('gp1'); $service->users_messages->send('me', $msg); This results in a bounce email because I have no clue how to set the raw message. I see the bounce in the inbox of my authenticated user. I want to learn how to set values for 'To', 'Cc', 'Bcc', 'Subject', and 'Body' of the email. I believe I will need to do a 64 encoding on that raw data as well. And I might want to use some html

Receiving Google Drive Push Notifications

我是研究僧i 提交于 2019-12-01 12:31:33
I have been able to establish a channel to receive push notifications from Google Drive by using the method described here Not receiving webhook notification from drive, why? . I am receiving notifications and everything is working fine. My problem is that when I receive the push notifications, I am only getting this information: Content-Length: 0 Accept: */* Accept-Encoding: gzip,deflate,br Connection: Keep-alive Host: www.domain.com User-Agent: APIs-Google; (+https://developers.google.com/webmasters/APIs-Google.html) X-Goog-Channel-Expiration: Thu, 29 Dec 2016 00:00:00 GMT X-Goog-Channel-Id:

Gmail API PHP Client Library - How do you send large attachments using the PHP client library?

那年仲夏 提交于 2019-12-01 12:16:26
I'm using Google's PHP client library to send calls to Gmail's API. Using those resources, I can send messages with attachments using code like this: public function send_message(Google_Service_Gmail $gmail, $raw_message) { Log::info('Gmail API request \'users_messages->send\''); $postBody = new Google_Service_Gmail_Message(); $postBody->setRaw(Str::base64_encode_url($raw_message)); return $gmail->users_messages->send('me', $postBody, ['uploadType' => 'multipart']); } But I can't for the life of me figure out how send attachments larger than a few MB. I've found that it is necessary to use

How to set validation method in Google spreadsheets API

 ̄綄美尐妖づ 提交于 2019-12-01 11:49:42
I am confused about the new Google Sheets API v4. My question is: how can I set validation rules for specified column(s) in spreadsheet? There is no useful tutorial with description how to use appropriate methods. Result should look like following sample: That validation should be set before data upload (which works fine). My current code: $client = getClient(); $service = new Google_Service_Sheets($client); $fileId = 'my-document-id'; $body = new Google_Service_Sheets_SetDataValidationRequest(array( 'setRange' => new Google_Service_Sheets_GridRange( array( 'sheetId'=>'List1',

Google calendar API- Invitation email doesn't send to attendees when create event

大城市里の小女人 提交于 2019-12-01 11:28:23
I want to add event to google calendar using google api. But after event created, invitation email doesn't send to attendees email list. Here is my code: <?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"); // Visit https://code.google.com/apis/console?api=calendar to generate your // client id, client secret, and to register your redirect uri. $client->setClientId('309388785502.apps.googleusercontent.com'); $client-

Youtube Data API v3: like comment of another user

不羁岁月 提交于 2019-12-01 11:23:23
I want to use the Youtube Data API to like comments. When I try to like a comment from myself it works without any problem, but when I try to like a comment from someone else I get an error. "reason": "invalidCommentMetadata", "message": "The request metadata is invalid.", I am using the Google API PHP Client. This is the code that I use to update the like: $videoComments = $youtube->comments->listComments('snippet', array( 'id' => $comment->id )); $videoComments[0]->snippet->viewerRating = 'like'; $videoCommentUpdateResponse = $youtube->comments->update('snippet', $videoComments[0]); I

Refreshing Tokens with Google API for Google Calendar v3

耗尽温柔 提交于 2019-12-01 11:14:52
I'm trying to use Google API (PHP) to perform a daily sync between a system calendar and the user's Google Calendars. I want a system user to be able to set up access to their calendar once from within the system, then the system can synchronise the calendars each day via a cron job. I have managed to get the entire process working, from authorising the access to syncing the calendars, but I am getting stuck with the token expiry times. The way I thought it worked in v3 was the old token would act as the refresh token. So, once a user had provided authorisation, I just need to pass the old

send email using gmail-api and google-api-php-client

感情迁移 提交于 2019-12-01 10:03:37
问题 I am using https://github.com/google/google-api-php-client and I want to send a test email with a user's authorized gmail account. This is what I have so far: $msg = new Google_Service_Gmail_Message(); $msg->setRaw('gp1'); $service->users_messages->send('me', $msg); This results in a bounce email because I have no clue how to set the raw message. I see the bounce in the inbox of my authenticated user. I want to learn how to set values for 'To', 'Cc', 'Bcc', 'Subject', and 'Body' of the email.

BigQuery streaming 'insertAll' performance with PHP

狂风中的少年 提交于 2019-12-01 07:10:30
问题 We're streaming a high volume of data server-side into BigQuery using the google-api-php-client library. The streaming works fine apart from the performance. Our load testing is giving us an average time of 1000ms (1 sec) to stream one row into BigQuery. We can't have the client waiting for more than 200ms. We've tested with smaller payloads and the time remains the same. Async calls on the client side is not an option for us. The 'bottleneck' line of code is: $service->tabledata->insertAll

Upload large file to google drive with PHP Client Library

旧街凉风 提交于 2019-12-01 03:18:41
I am trying to use the Google Drive API via their PHP Client Library to upload a large file. Currently it fails because the only method seemingly available is the "simple" upload method. Unfortunately that requires you to load the entire file as data and it hits my php memory limit. I would like to know if it is possible and see an example of how it is done. I know there is a method for resumable and chuncked uploads, but there is no documentation on how to use it. <?php require_once 'google-api-php-client/src/Google_Client.php'; require_once 'google-api-php-client/src/contrib/Google