150 lines
3.2 KiB
PHP
Executable File
150 lines
3.2 KiB
PHP
Executable File
<?php
|
|
require_once 'Framework/Controleur.php';
|
|
|
|
class ControleurAjaxtesterdisponiblitesms extends Controleur {
|
|
|
|
public function __construct()
|
|
{
|
|
}
|
|
|
|
public function index()
|
|
{
|
|
}
|
|
|
|
public function envoyerlesms()
|
|
{
|
|
$destinataires = $this->requete->getParametreFormulaire("destinataires");
|
|
$message = $this->requete->getParametreFormulaire("message");
|
|
$fournisseurSms = $this->requete->getParametreFormulaire("fournisseurSms");
|
|
|
|
// var_dump($fournisseurSms);
|
|
|
|
$dest = explode(',', $destinataires);
|
|
|
|
// var_dump($dest);
|
|
|
|
foreach ($dest as $tel)
|
|
{
|
|
if($fournisseurSms=="esicia")
|
|
{
|
|
$this->envoyersmsesicia($tel, $message);
|
|
}
|
|
elseif($fournisseurSms=="blive")
|
|
{
|
|
$this->envoyersmsbliive($tel, $message);
|
|
}
|
|
elseif($fournisseurSms=="hooza")
|
|
{
|
|
$this->envoyersmshooza($tel, $message);
|
|
}
|
|
}
|
|
}
|
|
|
|
public function envoyersmsbliive($destinataires_c, $message_c)
|
|
{
|
|
// problème avec le https
|
|
// $url = "http://app.blive.bi/bridge-ws/ws/send";
|
|
$url = "https://app.blive.bi/bridge-ws/ws/send";
|
|
|
|
$get = array
|
|
(
|
|
'id' =>'snd-4b3abf81d-21707',
|
|
'from' =>'MEDICOR',
|
|
'to' =>$destinataires_c,
|
|
'text' =>$message_c
|
|
);
|
|
|
|
$ch = curl_init();
|
|
curl_setopt($ch, CURLOPT_URL, $url);
|
|
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
|
curl_setopt($ch, CURLOPT_USERPWD, "BICOR-VIE:60cd7371a27c410484a1b485d273bef9");
|
|
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
|
|
curl_setopt($ch, CURLOPT_POST, TRUE);
|
|
curl_setopt($ch, CURLOPT_POSTFIELDS, $get);
|
|
|
|
$result = curl_exec($ch);
|
|
|
|
if (curl_errno($ch))
|
|
{
|
|
echo 'Error:' . curl_error($ch);
|
|
curl_close($ch);
|
|
exit();
|
|
}
|
|
|
|
$info = curl_getinfo($ch);
|
|
var_dump($result);
|
|
exit();
|
|
|
|
curl_close($ch);
|
|
|
|
// A SUPPRIMER
|
|
var_dump($result);
|
|
}
|
|
|
|
public function envoyersmsesicia($destinataires_c, $message_c)
|
|
{
|
|
// var_dump($destinataires_c);
|
|
|
|
// problème avec le https
|
|
$url = "http://gateway.esicia.com/sendsms/?";
|
|
|
|
$postFields = array
|
|
(
|
|
'ohereza' =>'MEDICARE',
|
|
'kuri' =>$destinataires_c,
|
|
'ubutumwa' =>$message_c,
|
|
'client' =>'radiant',
|
|
'password' =>'umugozi',
|
|
'msgid' =>'kanesin'
|
|
);
|
|
|
|
$post = http_build_query($postFields);
|
|
|
|
$url .= $post;
|
|
|
|
$result = file_get_contents($url);
|
|
|
|
// A SUPPRIMER
|
|
var_dump($result);
|
|
}
|
|
|
|
public function envoyersmshooza($destinataires_c, $message_c)
|
|
{
|
|
// var_dump($destinataires_c);
|
|
|
|
$url = "http://rslr.connectbind.com/bulksms/bulksms";
|
|
|
|
$get = array
|
|
(
|
|
'username' =>'HoAj-radiant',
|
|
'password' =>'radiant',
|
|
'type' =>'0',
|
|
'dlr' =>'1',
|
|
'destination' =>$destinataires_c,
|
|
'source' =>'MEDICARE',
|
|
'message' =>$message_c
|
|
);
|
|
|
|
$defaults = array(
|
|
CURLOPT_URL => $url. (strpos($url, '?') === FALSE ? '?' : ''). http_build_query($get),
|
|
// CURLOPT_URL => $url,
|
|
CURLOPT_HEADER => 0,
|
|
CURLOPT_RETURNTRANSFER => TRUE,
|
|
CURLOPT_TIMEOUT => 10
|
|
);
|
|
|
|
$ch = curl_init();
|
|
|
|
curl_setopt_array($ch, ($defaults));
|
|
if( ! $result = curl_exec($ch))
|
|
{
|
|
trigger_error(curl_error($ch));
|
|
}
|
|
|
|
curl_close($ch);
|
|
|
|
// A SUPPRIMER
|
|
var_dump($result);
|
|
}
|
|
|
|
} |