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.

76 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

Responder a ผลบอลสด Cancelar la respuesta

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