public function sendSms($phone, $message, $countryId) { $logFile = _PS_ROOT_DIR_ . '/var/logs/smsinvoice.log'; // Cesta k log súboru $country = new Country($countryId); $connection = new ConnectionStream(/*application_id: */ 31089, /*application_token:*/ 'sGRmOB1sNza22Ryu8IhoUrresrwtbjBJJeKGM4R5Zcg1aSGqll'); $sender = new MessageSender($connection); $number_checker = new NumberChecker($connection); // Kontrola telefónneho čísla cez BulkGate API try { $check = $number_checker->check([$phone], $country->iso_code); } catch (Exception $e) { file_put_contents($logFile, "[ERROR] NumberChecker failed: " . $e->getMessage() . "\n", FILE_APPEND); $check = []; } // Ak kontrola čísla prebehla úspešne if (isset($check[$phone]) && $check[$phone]['valid']) { $phone = $check[$phone]['phone_number']; } else { file_put_contents($logFile, "[WARNING] Invalid phone number: $phone\n", FILE_APPEND); // Ak nie je platné číslo, pokračujeme bez kontroly } // Pripravenie SMS $smsMessage = new Sms($phone, $message); // Odoslanie SMS try { $response = $sender->send($smsMessage); } catch (Exception $e) { file_put_contents($logFile, "[ERROR] BulkGate API failed: " . $e->getMessage() . "\n", FILE_APPEND); return false; } // Logovanie odpovede API file_put_contents($logFile, "[INFO] BulkGate API Response: " . json_encode($response) . "\n", FILE_APPEND); // Overenie odpovede if ($response->status == 'accepted') { return true; } else { file_put_contents($logFile, "[ERROR] SMS failed, response: " . json_encode($response) . "\n", FILE_APPEND); return false; } } Neue Artikel

No product at this time

Aktive Filter

  • Neu
    • Neu
      • Neu
        12,00 €Preis
        Kein Produkt verfügbar
        • Neu
          Kein Produkt verfügbar
          12,00 €Preis
          • Neu
            • Neu
              • Neu
                6,00 €Preis
                Kein Produkt verfügbar
                • Neu
                  Kein Produkt verfügbar
                  6,00 €Preis
                  • Neu
                    • Neu
                      • Neu
                        6,00 €Preis
                        Kein Produkt verfügbar
                        • Neu
                          Kein Produkt verfügbar
                          6,00 €Preis
                          • Neu
                            • Neu
                              • Neu
                                12,00 €Preis
                                Kein Produkt verfügbar
                                • Neu
                                  Kein Produkt verfügbar
                                  12,00 €Preis