Created
December 15, 2012 12:42
-
-
Save anonymous/4294511 to your computer and use it in GitHub Desktop.
Ejemplo de envio de un SMS con PHP usando la API de Panacea Mobile
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 en el mensaje | |
// 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(); | |
$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); | |
if($api->ok($result)) { | |
echo "<p>SMS enviado! ID: {$result['details']}</p>"; | |
} else { | |
echo "<p>Fallo al intentar mandar el sms <br/>\n{$api->getError()}</p>"; | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment