Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> [PHP]api Google Calender
goartur
post
Post #1





Grupa: Zarejestrowani
Postów: 233
Pomógł: 27
Dołączył: 19.10.2014

Ostrzeżenie: (0%)
-----


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.
Go to the top of the page
+Quote Post
markuz
post
Post #2





Grupa: Zarejestrowani
Postów: 1 240
Pomógł: 278
Dołączył: 11.03.2008

Ostrzeżenie: (0%)
-----


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".


--------------------
Go to the top of the page
+Quote Post
goartur
post
Post #3





Grupa: Zarejestrowani
Postów: 233
Pomógł: 27
Dołączył: 19.10.2014

Ostrzeżenie: (0%)
-----


To to dzieki, lecz znalazlem lepsze i latwiejsze rozwiazanie.
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
1 Użytkowników czyta ten temat (1 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 19.08.2025 - 10:16