Pomoc - Szukaj - Użytkownicy - Kalendarz
Pełna wersja: [PHP]api Google Calender
Forum PHP.pl > Forum > Przedszkole
goartur
Chce uzyc API od google Calender i uzywam tej dokumentacji:
https://developers.google.com/google-apps/c.../quickstart/php

Nie rozumie tego:
  1. define('APPLICATION_NAME', 'Google Calendar API PHP Quickstart');
  2. define('CREDENTIALS_PATH', '~/.credentials/calendar-php-quickstart.json');
  3. define('CLIENT_SECRET_PATH', __DIR__ . '/client_secret.json');


Czym jest
  1. CREDENTIALS_PATH
?
Wiem ze CLIENT_SECRET_PATH jest plikiem ktory zostal pobrany przy tworzeniu auth aplikacji.
markuz
Tutaj masz wyjaśnione:
  1. // Load previously authorized credentials from a file.
  2. $credentialsPath = expandHomeDirectory(CREDENTIALS_PATH);
  3. if (file_exists($credentialsPath)) {
  4. $accessToken = json_decode(file_get_contents($credentialsPath), true);
  5. } else {
  6. // Request authorization from the user.
  7. $authUrl = $client->createAuthUrl();
  8. printf("Open the following link in your browser:\n%s\n", $authUrl);
  9. print 'Enter verification code: ';
  10. $authCode = trim(fgets(STDIN));
  11.  
  12. // Exchange authorization code for an access token.
  13. $accessToken = $client->fetchAccessTokenWithAuthCode($authCode);
  14.  
  15. // Store the credentials to disk.
  16. if(!file_exists(dirname($credentialsPath))) {
  17. mkdir(dirname($credentialsPath), 0700, true);
  18. }
  19. file_put_contents($credentialsPath, json_encode($accessToken));
  20. printf("Credentials saved to %s\n", $credentialsPath);
  21. }


W skrócie: "previously authorized credentials".
goartur
To to dzieki, lecz znalazlem lepsze i latwiejsze rozwiazanie.
To jest wersja lo-fi głównej zawartości. Aby zobaczyć pełną wersję z większą zawartością, obrazkami i formatowaniem proszę kliknij tutaj.
Invision Power Board © 2001-2025 Invision Power Services, Inc.