Envoyer SMS par PHP Diafaan
<?php
/*
PHP script to send SMS messages with the HTTP API of Diafaan SMS Server
*/
echo SendMessage('localhost', '9710', 'admin', 'password', '+32xxxxxxxxxx', 'My text message');
function SendMessage($host, $port, $userName, $password, $number, $message)
{
/* Create the HTTP API query string */
$query = 'http://'.$host.':'.$port;
$query .= '/http/send-message/';
$query .= '?username='.urlencode($userName);
$query .= '&password='.urlencode($password);
$query .= '&to='.urlencode($number);
$query .= '&message='.urlencode($message);
/* Send the HTTP API request and return the response */
return file_get_contents($query);
}
?>
Snippets