Alarmas Sms (gracias a google)

Hola el otro dia vi en el blog de Ivan L?pez como usaba las alarmas del google calendar, para enviarse SMS al m?vil con ‘alertas’, y as? poder tener controlado sus servidores.
El ‘problema’, es que esta en java, as? que decid? hacer lo mismo pero en php, para que mas gente pudiese usarlo.

El modo de empleo es el mismo, necesitas PHP 5.1.4 o superior (son las necesarias para usar la API) y las librer?as ZEND de Gdata.

Para mas informaci?n del uso de la API se puede mirar directamente a la web de google code.

/*
** Generador de alertas sms a traves de google
** Basado en el de Ivan Lopez (lopezivan.blogspot.com)
** Elias Badenes, 2007
** elias (at) badenes (dot) es
*/
require_once 'Zend/Loader.php';
Zend_Loader::loadClass('Zend_Gdata');
Zend_Loader::loadClass('Zend_Gdata_AuthSub');
Zend_Loader::loadClass('Zend_Gdata_ClientLogin');
Zend_Loader::loadClass('Zend_Gdata_Calendar');

function crearAlerta($cliente, $texto) {
$dia? = date('Y-m-d');
$hIni = date('H:i', strtotime('now +6 minutes'));
$hFin = date('H:i', strtotime('now +7 minute'));

$gdataCal = new Zend_Gdata_Calendar($cliente);
$evento?? = $gdataCal->newEventEntry();
$startDate = $dia;
$endDate?? = $dia;
$tzOffset? = '+02'; //en verano '+02' en invierno '+01'
$startTime = $hIni;
$endTime?? = $hFin;

//asigno el texto
$evento->title = $gdataCal->newTitle($texto);

//Asigno el tiempo
$cuando = $gdataCal->newWhen();
$cuando->startTime = "{$startDate}T{$startTime}:00.000{$tzOffset}:00";
$cuando->endTime = "{$endDate}T{$endTime}:00.000{$tzOffset}:00";

//alerta sms
$metodo = 'sms'; //alert, email o sms
$alerta = $gdataCal->newReminder();
$alerta->setMinutes(5);
$alerta->setMethod('sms');
$cuando->setReminders(array($alerta));

$evento->when = array($cuando);

echo 'Insertando Alerta: '.$texto."n";
$a = $gdataCal->insertEvent($evento);
}

if(count($argv) < 4) {
echo "Uso: $argv[0] <usuario> <password> <texto>n";
die();
}

$usuario? = $argv[1];
$password = $argv[2];
$texto??? = '';
$argc???? = count($argv);

for( $i=3; $i>$argc; $i++) {
$texto .= $argv[$i].' ';
}

$servicio = Zend_Gdata_Calendar::AUTH_SERVICE_NAME;
$cliente? = Zend_Gdata_ClientLogin::getHttpClient($usuario, $password, $servicio);
crearAlerta($cliente, trim($texto));

Espero que lo disfruteis.

82 Comments

  1. Bftzru dice:

    famciclovir over the counter – buy generic famciclovir over the counter brand valaciclovir

  2. Onuvbw dice:

    digoxin 250mg pill – trandate 100 mg generic how to get lasix without a prescription

  3. Mmcphu dice:

    order microzide 25 mg without prescription – norvasc usa bisoprolol 10mg pill

  4. I am truly thankful to the owner of this web site who has shared this fantastic piece of writing at at this place.

  5. very informative articles or reviews at this time.

  6. Great information shared.. really enjoyed reading this post thank you author for sharing this post .. appreciated

  7. I am truly thankful to the owner of this web site who has shared this fantastic piece of writing at at this place.

  8. Very well presented. Every quote was awesome and thanks for sharing the content. Keep sharing and keep motivating others.

  9. There is definately a lot to find out about this subject. I like all the points you made

  10. Great information shared.. really enjoyed reading this post thank you author for sharing this post .. appreciated

  11. Good post! We will be linking to this particularly great post on our site. Keep up the great writing

  12. I very delighted to find this internet site on bing, just what I was searching for as well saved to fav

  13. Pretty! This has been a really wonderful post. Many thanks for providing these details.

  14. I like the efforts you have put in this, regards for all the great content.

  15. You’re so awesome! I don’t believe I have read a single thing like that before. So great to find someone with some original thoughts on this topic. Really.. thank you for starting this up. This website is something that is needed on the internet, someone with a little originality!

  16. Efpkvs dice:

    lopressor for sale – adalat for sale adalat 10mg without prescription

  17. Pretty! This has been a really wonderful post. Many thanks for providing these details.

  18. I appreciate you sharing this blog post. Thanks Again. Cool.

  19. This was beautiful Admin. Thank you for your reflections.

  20. Nice post. I learn something totally new and challenging on websites

  21. very informative articles or reviews at this time.

  22. This is really interesting, You’re a very skilled blogger. I’ve joined your feed and look forward to seeking more of your magnificent post. Also, I’ve shared your site in my social networks!

  23. This is really interesting, You’re a very skilled blogger. I’ve joined your feed and look forward to seeking more of your magnificent post. Also, I’ve shared your site in my social networks!

  24. I very delighted to find this internet site on bing, just what I was searching for as well saved to fav

  25. This was beautiful Admin. Thank you for your reflections.

  26. I just like the helpful information you provide in your articles

  27. Very well presented. Every quote was awesome and thanks for sharing the content. Keep sharing and keep motivating others.

  28. Hi there to all, for the reason that I am genuinely keen of reading this website’s post to be updated on a regular basis. It carries pleasant stuff.

  29. I really like reading through a post that can make men and women think. Also, thank you for allowing me to comment!

  30. Pretty! This has been a really wonderful post. Many thanks for providing these details.

  31. Pretty! This has been a really wonderful post. Many thanks for providing these details.

  32. This is my first time pay a quick visit at here and i am really happy to read everthing at one place

Responder a Eduthw Cancelar la respuesta

Tu dirección de correo electrónico no será publicada. Los campos obligatorios están marcados con *