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.

40 Comments

  1. CeleneKet dice:

    Doctors rarely probe into the full set of psychiatric and physical symptoms of their patients which could indicate TBD buy finasteride

  2. Your blog post had me hooked from the first sentence.

  3. Cwgsoz dice:

    atorvastatin 20mg over the counter order atorvastatin 40mg buy cheap generic lipitor

  4. Dbwhaj dice:

    cipro 1000mg cost – buy keflex 500mg buy amoxiclav sale

  5. Imdmpc dice:

    buy cipro pills for sale – buy generic myambutol for sale how to get augmentin without a prescription

  6. Eowmss dice:

    purchase flagyl generic – how to buy amoxicillin azithromycin 500mg oral

  7. Qedszs dice:

    ciplox 500 mg for sale – brand erythromycin 500mg erythromycin canada

  8. Ymqjav dice:

    order generic valacyclovir – buy valacyclovir online cheap acyclovir generic

  9. Ghahbw dice:

    buy ivermectin stromectol – purchase suprax for sale buy sumycin 250mg pill

  10. Poughj dice:

    metronidazole over the counter – order cefaclor 250mg online buy zithromax 500mg sale

  11. e-commerce dice:

    Wow, wonderful weblog layout! How long have
    you been blogging for? you make blogging glance easy.

    The total glance of your site is great, as smartly as the
    content material! You can see similar here e-commerce

  12. Have you ever thought about including a
    little bit more than just your articles? I mean, what you say is
    fundamental and everything. Nevertheless think of if you added some great visuals or videos to give your posts more, «pop»!
    Your content is excellent but with images and clips, this blog could definitely be one
    of the very best in its niche. Wonderful blog! I saw similar here: Najlepszy sklep

  13. Jdrfpl dice:

    purchase ampicillin sale buy generic ampicillin purchase amoxil

  14. Nfhdqk dice:

    furosemide ca – buy captopril without prescription order capoten for sale

  15. sklep online dice:

    Hi there! Do you know if they make any plugins to assist with Search Engine Optimization? I’m trying
    to get my blog to rank for some targeted keywords but I’m not seeing very good success.
    If you know of any please share. Cheers!
    You can read similar text here: Najlepszy sklep

  16. It’s very interesting! If you need help, look here: ARA Agency

  17. Oyehbn dice:

    metformin 1000mg cost – order glucophage 1000mg pill buy lincocin pills for sale

  18. Fhcgsu dice:

    retrovir drug – order glycomet 500mg order zyloprim 100mg online cheap

  19. Xlrnyc dice:

    how to buy clozaril – oral ramipril purchase famotidine online cheap

  20. Llednb dice:

    quetiapine 50mg for sale – buy eskalith online cheap buy eskalith pill

  21. Ndfjlf dice:

    anafranil sale – tofranil 75mg brand pill doxepin

  22. Idlaie dice:

    oral hydroxyzine 25mg – purchase fluoxetine sale endep sale

  23. Hi there! Do you know if they make any plugins to assist with Search Engine Optimization? I’m trying to get my site to rank for some targeted keywords
    but I’m not seeing very good results. If you know of any please share.
    Appreciate it! You can read similar art here: Auto Approve List

  24. Hey there! Do you know if they make any plugins
    to help with Search Engine Optimization? I’m trying to
    get my blog to rank for some targeted keywords but I’m not seeing very good success.

    If you know of any please share. Appreciate it! I saw similar
    article here: GSA Verified List

  25. Cvydyv dice:

    cheap amoxil online – brand cefadroxil 500mg buy cipro 500mg for sale

  26. Jmyfrs dice:

    cost amoxiclav – buy ethambutol cheap buy generic ciprofloxacin 500mg

  27. ufabet911 dice:

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

  28. ufabet911 dice:

    very informative articles or reviews at this time.

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

  30. ufaland dice:

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

  31. UFABET dice:

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

  32. Udwbfh dice:

    where can i buy clindamycin – oxytetracycline where to buy chloramphenicol pills

  33. Wtqcwt dice:

    buy zithromax online cheap – flagyl 200mg brand cost ciplox 500 mg

  34. Idkpqh dice:

    ivermectin price – order generic doxycycline cheap cefaclor 250mg

  35. Zyrcyv dice:

    buy albuterol sale – buy phenergan tablets buy generic theo-24 Cr 400 mg

  36. e-commerce dice:

    Wow, amazing weblog format! How lengthy have you ever been running a blog for?
    you make blogging look easy. The total look of your website is excellent,
    as neatly as the content material! You can see similar here najlepszy sklep

  37. Eduthw dice:

    buy clarinex generic – purchase beclamethasone generic albuterol uk

  38. binance kód dice:

    Thank you for your sharing. I am worried that I lack creative ideas. It is your article that makes me full of hope. Thank you. But, I have a question, can you help me?

  39. Esvvcc dice:

    depo-medrol pills canada – claritin 10mg cheap order astelin 10 ml sale

  40. Gbcyjc dice:

    micronase 2.5mg brand – order pioglitazone online cheap forxiga 10 mg generic

Deja una respuesta

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