Primer Commit
This commit is contained in:
parent
8eea1e9163
commit
8f0c1549f3
@ -1,60 +0,0 @@
|
||||
<?php
|
||||
require 'vendor/autoload.php';
|
||||
|
||||
use Google\Client;
|
||||
use Google\Service\Drive;
|
||||
|
||||
// Configuración de Google Drive
|
||||
function getClient() {
|
||||
$client = new Client();
|
||||
$client->setApplicationName('Google Drive API PHP Quickstart');
|
||||
$client->setScopes(Drive::DRIVE_FILE);
|
||||
$client->setAuthConfig(__DIR__.'/credentials.json');
|
||||
$client->setAccessType('offline');
|
||||
$client->setPrompt('select_account consent');
|
||||
|
||||
$tokenPath = 'token.json';
|
||||
if (file_exists($tokenPath)) {
|
||||
$accessToken = json_decode(file_get_contents($tokenPath), true);
|
||||
$client->setAccessToken($accessToken);
|
||||
}
|
||||
|
||||
if ($client->isAccessTokenExpired()) {
|
||||
if ($client->getRefreshToken()) {
|
||||
$client->fetchAccessTokenWithRefreshToken($client->getRefreshToken());
|
||||
} else {
|
||||
$authUrl = $client->createAuthUrl();
|
||||
printf("Open the following link in your browser:\n%s\n", $authUrl);
|
||||
print 'Enter verification code: ';
|
||||
$authCode = trim(fgets(STDIN));
|
||||
|
||||
$accessToken = $client->fetchAccessTokenWithAuthCode($authCode);
|
||||
$client->setAccessToken($accessToken);
|
||||
|
||||
if (!file_exists(dirname($tokenPath))) {
|
||||
mkdir(dirname($tokenPath), 0700, true);
|
||||
}
|
||||
file_put_contents($tokenPath, json_encode($client->getAccessToken()));
|
||||
}
|
||||
}
|
||||
return $client;
|
||||
}
|
||||
|
||||
// Función para subir archivo a Google Drive
|
||||
function uploadFileToDrive($client, $filePath) {
|
||||
$driveService = new Drive($client);
|
||||
$fileMetadata = new Drive\DriveFile(array(
|
||||
'name' => basename($filePath)
|
||||
));
|
||||
$content = file_get_contents($filePath);
|
||||
$file = $driveService->files->create($fileMetadata, array(
|
||||
'data' => $content,
|
||||
'mimeType' => mime_content_type($filePath),
|
||||
'uploadType' => 'multipart',
|
||||
'fields' => 'id'
|
||||
));
|
||||
printf("File ID: %s\n", $file->id);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 232 KiB |
Binary file not shown.
Binary file not shown.
|
Before Width: | Height: | Size: 215 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 212 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 206 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 280 KiB |
@ -1 +1 @@
|
||||
{"ipserver":"172.16.5.134","apitoken":"6abef18c-783d-4dd0-b530-be6e6a7bbd1d","tokencallbell":"g8thcZkXGd3xBj2g3TtYNYFMH1fuesbJ.b6a940ea7d78cf6c9e42f067b21c8ddf96e9fa2a9e307bfd0c7c7c4d7fa38f79","tokenstripe":"sk_test_51OkG0REFY1WEUtgRH6UxBK5pu80Aq5Iy8EcdPnf0cOWzuVLQTpyLCd7CbPzqMsWMafZOHElCxhEHF7g8boURjWlJ00tBwE0W1M","unmsApiToken":null,"hostServerFTP":"siip.mx","usernameServerFTP":"siip0001","passServerFTP":"$spGiT,[wa)n","cashPaymentMethodId":false,"courtesyPaymentMethodId":false,"bankTransferPaymentMethodId":true,"paypalPaymentMethodId":true,"creditCardPaypalPaymentMethodId":true,"creditCardStripePaymentMethodId":true,"stripeSubscriptionCreditCardPaymentMethodId":true,"paypalSubscriptionPaymentMethodId":true,"mercadopagoPaymentMethodId":true,"checkPaymentMethodId":true,"customPaymentMethodId":true,"notificationTypeText":false,"debugMode":true,"logging_level":true}
|
||||
{"ipserver":"172.16.5.134","apitoken":"6abef18c-783d-4dd0-b530-be6e6a7bbd1d","tokencallbell":"g8thcZkXGd3xBj2g3TtYNYFMH1fuesbJ.b6a940ea7d78cf6c9e42f067b21c8ddf96e9fa2a9e307bfd0c7c7c4d7fa38f79","tokenstripe":"sk_test_51OkG0REFY1WEUtgRH6UxBK5pu80Aq5Iy8EcdPnf0cOWzuVLQTpyLCd7CbPzqMsWMafZOHElCxhEHF7g8boURjWlJ00tBwE0W1M","unmsApiToken":null,"hostServerFTP":"siip.mx","usernameServerFTP":"siip0001","passServerFTP":"$spGiT,[wa)n","cashPaymentMethodId":false,"courtesyPaymentMethodId":false,"bankTransferPaymentMethodId":true,"paypalPaymentMethodId":true,"creditCardPaypalPaymentMethodId":true,"creditCardStripePaymentMethodId":true,"stripeSubscriptionCreditCardPaymentMethodId":true,"paypalSubscriptionPaymentMethodId":true,"mercadopagoPaymentMethodId":true,"checkPaymentMethodId":true,"customPaymentMethodId":true,"notificationTypeText":false,"debugMode":true,"logging_level":true,"dataInstallersWhatsApp":"{ \"instaladores\": [{\"ID\": 1015, \"nombre\": \"Daniel Peña, \"whatsapp\": 4181878106}, {\"ID\": 1020, \"nombre\": \"Angel Arvizu\", \"whatsapp\": 4123456789}, {\"ID\": 1035,\"nombre\": \"Juan Rostro, \"whatsapp\": 4198765432}] }"}
|
||||
1367
data/plugin.log
1367
data/plugin.log
File diff suppressed because it is too large
Load Diff
0
siip-whatsapp-notifications.zip
Normal file → Executable file
0
siip-whatsapp-notifications.zip
Normal file → Executable file
Loading…
Reference in New Issue
Block a user