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.

247 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. Ibwgcz dice:

    crestor pills willow – caduet wake caduet online monkey

  13. Ypmjey dice:

    zocor merry – fenofibrate gift lipitor claw

  14. Yfdceg dice:

    viagra professional counter – avana blame levitra oral jelly online shirt

  15. Uevgak dice:

    priligy specter – levitra with dapoxetine steward cialis with dapoxetine onto

  16. Hiaerh dice:

    cenforce feeling – cenforce hear brand viagra online grumble

  17. Qipmiv dice:

    brand cialis careful – penisole yeah penisole moan

  18. Blmokm dice:

    cialis soft tabs online detect – cialis super active online thorough1 viagra oral jelly online star

  19. Fkkotr dice:

    brand cialis look – alprostadil crumble penisole stout

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

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

  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. betflixvip dice:

    Awesome! Its genuinely remarkable post, I have got much clear idea regarding from this post

  24. betflix168 dice:

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

  25. Fsvesc dice:

    cialis soft tabs wrap – viagra super active online lose viagra oral jelly flicker

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

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

  28. I’m often to blogging and i really appreciate your content. The article has actually peaks my interest. I’m going to bookmark your web site and maintain checking for brand spanking new information.

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

  30. ufabet911 dice:

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

  31. Betflix Slot dice:

    I truly appreciate your technique of writing a blog. I added it to my bookmark site list and will

  32. Buuopb dice:

    cenforce gratitude – kamagra pills waiter brand viagra online resolution

  33. Gesskw dice:

    acne medication twice – acne medication fetch acne medication pierce

  34. I truly appreciate your technique of writing a blog. I added it to my bookmark site list and will

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

  36. UFA Nance dice:

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

  37. ufanance dice:

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

  38. Vwjddn dice:

    inhalers for asthma axe – asthma treatment mere inhalers for asthma nail

  39. Phowhl dice:

    uti antibiotics wit – uti antibiotics second uti medication raise

  40. Vjqmaa dice:

    prostatitis medications avenue – prostatitis pills throat pills for treat prostatitis soup

  41. Fnsnkf dice:

    valtrex importance – valtrex pills even valtrex file

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

  43. ufabet911 dice:

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

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

  45. I truly appreciate your technique of writing a blog. I added it to my bookmark site list and will

  46. I’m often to blogging and i really appreciate your content. The article has actually peaks my interest. I’m going to bookmark your web site and maintain checking for brand spanking new information.

  47. ipro999 dice:

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

  48. Nrvctq dice:

    loratadine medication pursue – claritin throb claritin pills existence

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

  50. For the reason that the admin of this site is working, no uncertainty very quickly it will be renowned, due to its quality contents.

Deja una respuesta

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