Category Archives: Google API Oauth2.0

PHP upload file Google Cloud Storage and import to Google big query

1. Download Google API Client Library for PHP 2. composer install to load vender 3. Enjoy my script (now the google-api-php-client version google/apiclient:^2.0.0@RC) require_once __DIR__.’/../vendor/autoload.php’; // [START all] // [START build_service $client = new Google_Client(); $key_file_location = ‘privatekey-bigquery.p12′; $key = … Continue reading

Posted in Google API Oauth2.0 | Leave a comment

Google API get credentials json server to server

1. login your account go to https://console.developers.google.com 2. คลิกที่ service account key 3. เลือก service account และเลือก Import Json

Posted in Google API Oauth2.0 | Leave a comment

Google app engine for php use google api client

reference https://gaeforphp-blog.appspot.com/2013/08/06/using-the-google-apis-client-library-for-php-with-app-engine/ #google app engine for php can’t use curl but can use http_stream with stream_context_create() , change ioClass from Google_CurlIO to Google_HttpStreamIO Follow these steps to get the client library up and running. Download the latest release package of the client. Extract … Continue reading

Posted in Google API Oauth2.0, google app engine | Leave a comment

Google API check access token expires

Assume you know how to request access token. In this example we store access token on $_SESSION. Follow docs https://developers.google.com/accounts/docs/OAuth2UserAgent#validatetoken in example below implement with PHP $_SESSION[’token’] = $client->getAccessToken(); if(isset($_SESSION["token"])) { $accessToken = $_SESSION[’token’]; $tokenArray = json_decode($accessToken,true); $urlCheckToken = "https://www.googleapis.com/oauth2/v1/tokeninfo?access_token=".$tokenArray["access_token"]; … Continue reading

Posted in Google API Oauth2.0 | Leave a comment