google-api-php-client

How to update file in google drive v3 PHP

浪子不回头ぞ 提交于 2019-12-04 03:37:35
I cant seem to update file in google drive with the following code, everything goes fine but file remains untouched? I am working with v3 api. function updateFile($service, $fileId, $data) { try { $emptyFile = new Google_Service_Drive_DriveFile(); $file = $service->files->get($fileId); $service->files->update($fileId, $emptyFile, array( 'data' => $data, 'mimeType' => 'text/csv', 'uploadType' => 'multipart' )); } catch (Exception $e) { print "An error occurred: " . $e->getMessage(); } } MapleSyrup I managed to do it, you have to put empty file as second argument, not sure why but this post

Class “Google_Config” not found

两盒软妹~` 提交于 2019-12-04 03:23:09
问题 I'm trying to implement Google's login API via the instructions here, but for some reason, when I try to run it, I always get: Fatal error: Class 'Google_Config' not found in /home/.../Google/Client.php on line 76 I'm quite sure I linked to Client.php correctly - I don't think it's a problem within my own code. Does anyone know what might be happening here? Thanks! 回答1: This error means that you didn't use Composer, to install the client. Without Composer, in your script you should set

Get Calendar events between two dates

偶尔善良 提交于 2019-12-04 02:23:04
How to get all events between two specific dates. For example i only want to get events between 1st of March 2013 & 28th of March 2013 . I am using Google Calendar API v3. While in Google Calendar API v1 there was the facility for search between 2 dates using start-min & start-max. I am wondering what is the replacement for these two parameters in Google Calendar API v3? Ok i got the answer. The new parameters in Google API V3 are timeMin & timeMax to filter events between 2 dates. Just add these two parameters to the query before getting the event feed: // Start date from where to get the

Youtube Data API v3: like comment of another user

匆匆过客 提交于 2019-12-04 01:57:27
问题 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 =

Adding google api client to codeigniter

家住魔仙堡 提交于 2019-12-03 14:41:07
问题 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 libraries folder google.php file <?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

How to upload Video to YouTube using Google API PHP Client Library and Youtube API V3?

时光总嘲笑我的痴心妄想 提交于 2019-12-03 14:19:27
Trying to simply upload video using Google API PHP Client (latest release 1.1.6) , but code in Youtube API V3 is not working and giving 500 internal server error. What is wrong with code below when I am not using any bleeding edge beta version, I have just masked 3 parameters below otherwise it is copied form Youtube API V3 . require_once 'google-api-php-client/src/Google/Client.php'; require_once 'google-api-php-client/src/Google/Service/YouTube.php'; session_start(); $OAUTH2_CLIENT_ID = 'CHANGE1-0osfh0p5h80o9ol2uqtsjq5i7r1jun.apps.googleusercontent.com'; $OAUTH2_CLIENT_SECRET = 'CHANGE2azMpt

Google Drive API v3 - downloading files in PHP

匆匆过客 提交于 2019-12-03 13:34:11
问题 I'm trying to understand the download flow for the Google Drive API v3 using PHP. Using the API v2 to download a file I: Got the file metadata Used the downloadUrl parameter to get a direct link to the file, attached an oAuth token to it and made a GET request to that. Using API v3 this appears to have been deprecated, and according to the docs you call files->get() on the Drive Service with an array parameter of "alt" => "media" to get the file itself rather than the metadata. And their

Google OAuth 2.0 “error” : “redirect_uri_mismatch”

安稳与你 提交于 2019-12-03 09:04:53
问题 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'); curl_setopt($ch,CURLOPT_POSTFIELDS,'code=4%2FPp1GWqC6PIr3wNYrZ5kK4T9oitxBoo0fBqBrVNQfE-g.ElKDUjQ7E28SoiIBeO6P2m-0RPaolgI&grant_type=authorization_code&redirect_uri=https%3A%2F%2Fmyprivatedomain.local.com

Google Analytics - Access api without login

假装没事ソ 提交于 2019-12-03 07:40:24
问题 I had successfully configured google analytics api and get successful data. I want to access analytics api without gmail login. i.e. I will hard code credentials to for login, but how to do it with PHP? Is there any api function to achive this task (for PHP) Thanks! 回答1: The Hello Analytics API: PHP Quickstart Guide for Service Accounts will walk you through the steps necessary to create and add a service account to your existing Google Analytics Account/Property/View. Once you download have

Google Drive API v3 - downloading files in PHP

房东的猫 提交于 2019-12-03 03:26:59
I'm trying to understand the download flow for the Google Drive API v3 using PHP. Using the API v2 to download a file I: Got the file metadata Used the downloadUrl parameter to get a direct link to the file, attached an oAuth token to it and made a GET request to that. Using API v3 this appears to have been deprecated, and according to the docs you call files->get() on the Drive Service with an array parameter of "alt" => "media" to get the file itself rather than the metadata. And their example was: $fileId = '0BwwA4oUTeiV1UVNwOHItT0xfa2M'; $content = $driveService->files->get($fileId, array(