alpha_full/admin/adminInclude/psk/monTokenSMS.php
2026-04-06 22:58:51 +02:00

48 lines
1.7 KiB
PHP
Executable File

<?php
$nomFicAppelant = basename(__FILE__);
// -----------------------------------------------------
// Version SMS Factor
// -----------------------------------------------------
// https://secure.smsfactor.com/token.html;
// -----------------------------------------------------
$faireFactorSMS=1;
//
if ($faireFactorSMS==1) {
$token = "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOiI0MzQxMyIsImlhdCI6MTYxOTI5NzM4OX0.WF7mz-IkZ_wXIs7khuibbBypEDKile9nSo3wc7nu-mk ";
$smsMessage = $smsMessage;
$sender = "123Ventes";
$recipients = array();
foreach ($numbers as $n) {
$recipients[] = array('value' => $n);
}
$postdata = array(
'sms' => array(
'message' => array(
'text' => $smsMessage,
'sender' => $sender
),
'recipients' => array('gsm' => $recipients)
)
);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://api.smsfactor.com/send");
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($postdata));
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json', 'Accept: application/json', 'Authorization: Bearer ' . $token));
$response = curl_exec($ch);
curl_close($ch);
if (isset($debug[1]) && $debug[1] == '1' ) $msg123=$msg123. '<br> Retour SMS' .$response;
}
else {
// -----------------------------------------------------
// Version SMS free API
// -----------------------------------------------------
setlocale (LC_TIME, 'fr_FR.utf8','fra');
$output='';
$monUrl='https://smsapi.free-mobile.fr/sendmsg?user=19135992&pass=NcUXH82kynfS5B&msg=' .$smsMessage;
include ("smsFree.php");
$admMsg .= '<br>' .$output;
}
?>