Category : google-api-php-client

I’m trying to listen for subscription changes (new and existing) of my Google Play app on the server. Here’s the code I’m using. This uses the google/cloud-pubsub composer package: $projectId = ‘app-name’; $keyFile = file_get_contents(storage_path(‘app/app-name.json’)); $pubsub = new PubSubClient([ ‘projectId’ => $projectId, ‘keyFile’ => json_decode($keyFile, true) ]); $httpPostRequestBody = file_get_contents(‘php://input’); $requestData = json_decode($httpPostRequestBody, true); info(json_encode($requestData)); ..

Read more

I’m trying to listen for subscription changes (new and existing) of my Google Play app on the server. Here’s the code I’m using. This uses the google/cloud-pubsub composer package: $projectId = ‘app-name’; $keyFile = file_get_contents(storage_path(‘app/app-name.json’)); $pubsub = new PubSubClient([ ‘projectId’ => $projectId, ‘keyFile’ => json_decode($keyFile, true) ]); $httpPostRequestBody = file_get_contents(‘php://input’); $requestData = json_decode($httpPostRequestBody, true); info(json_encode($requestData)); ..

Read more

I use package which is a part of another package. Here is my base class for writing to google big query table: <?php namespace AppServicesBigQuery; use GoogleCloudBigQueryBigQueryClient; use GoogleCloudBigQueryDataset; use GoogleCloudBigQueryTable; use IlluminateSupportCollection; use IlluminateSupportFacadesLog; abstract class BigQueryTool { protected Dataset $dataset; protected Table $table; protected string $tableName; protected string $schemaPath; protected int $chunkSize = ..

Read more

I’m trying to use laravel and google analytics to be able to build a report, the problem I’m getting is this { "error": { "code": 400, "message": "CLIENT_ID: {my_client_id} not found.", "errors": [ { "message": "CLIENT_ID: {my_client_id} not found.", "domain": "global", "reason": "badRequest" } ], "status": "INVALID_ARGUMENT" } } Here is my code <?php namespace ..

Read more

I am trying to set the context with the following code. $text = "Some Text"; $sessionsClient = new SessionsClient(array(‘credentials’ => base_path(‘/google-cloud.json’))); $session = $sessionsClient->sessionName(‘[project-id]’, uniqid()); $textInput = new TextInput(); $textInput->setText($text); $queryInput = new QueryInput(); $queryInput->setText($textInput); $textInput->setLanguageCode(‘en-US’); $queryParams = new QueryParameters(); $contextInput = new Context(); $contextInput->setLifespanCount(1); $contextInput->setName(‘Input_Text’); $queryParams->setContexts(array($contextInput)); $optionalsParams = array(‘queryParams’ => $queryParams); $response = $sessionsClient->detectIntent($session, ..

Read more

$user = Socialite::driver(‘google’)->user(); // Set token for the Google API PHP Client $google_client_token = [ ‘access_token’ => $user->token, ‘refresh_token’ => $user->refreshToken, ‘expires_in’ => $user->expiresIn ]; $client = new Google_Client(); $client->setApplicationName(“Laravel”); $client->setDeveloperKey(env(‘GOOGLE_SERVER_KEY’)); $client->setAccessToken(json_encode($google_client_token)); $client->setScopes(Google_Service_Fitness::FITNESS_ACTIVITY_READ); $fitness_service = new Google_Service_Fitness($client); $dataSources = $fitness_service->users_dataSources; $dataSets = $fitness_service->users_dataSources_datasets; $listDataSources = $dataSources->listUsersDataSources(“me”); dd($dataSets); I tried this but it always ended giving ..

Read more