-
-
Save jesusnoseq/4295322 to your computer and use it in GitHub Desktop.
Ejemplo de uso de la API de Panacea Mobile para enviar un SMS.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require_once("panacea_api.php"); | |
define('PANACEA_USER','TU USUARIO DE PANACEA'); | |
define('PANACEA_API_KEY','UNA DE TUS API KEY'); | |
// SMS_SENDER_NAME es el nombre con que le llega al destinatario el SMS | |
// Tened cuidado de no pasaros con el nombre. | |
// Si os pasais el SMS se envia pero no llega. | |
// Simplemente no os paseis de los 8 caracteres. | |
define('SMS_SENDER_NAME','PRUEBA'); | |
// telefono del destinatario | |
$tlf='34XXXXXXXXX'; //con prefijo (34 -> españa) | |
// texto del SMS | |
$msg="Esto es una prueba"; | |
$api = new PanaceaApi(); | |
// autentificacion | |
$api->setUsername(PANACEA_USER); | |
$api->setPassword(PANACEA_API_KEY); | |
// enviamos el SMS | |
$result = $api->message_send($tlf, $msg, SMS_SENDER_NAME, 19, null, | |
null, null, -1, 1); | |
// si el mensaje se ha enviado | |
if($api->ok($result)) { | |
echo "<p>SMS enviado! ID: {$result['details']}</p>"; | |
} else { | |
echo "<p>Fallo al enviar el SMS: ".$api->getError()."</p>"; | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment