This topic is locked

Adicionando eventos no no Calendário do google

5/11/2011 9:33:31 AM
PHPRunner Tips and Tricks
E
ericholiveira author

Existe duas formas de inserir seus eventos no calendário do GOOGLE a mais fácil é a seguinte.
Faça o download dos arquivos

GoogleCalendarWrapper.php

MyCurl.php
http://a4.users.phpclasses.org/package/3548-PHP-Register-events-in-Google-Calendar.html

http://a4.users.phpclasses.org/package/3547-PHP-Submit-HTTP-requests-with-the-CURL-extension.html
Adicione os arquivos no raiz do seu sistema
Adicione no codigo After Record Added



include "GoogleCalendarWrapper.php";

$gc = new GoogleCalendarWrapper("nome@gmail.com", "senha");



$gc->feed_url = "https://www.google.com/calendar/feeds/$emailgoogle/private-$chave/basic";;

$SQL = "SELECT * FROM tabela where codigo = ".$keys['id']."";

$rs = CustomQuery($SQL);

$r = db_fetch_array($rs);
$hora = $r['hora'];

$horaNova = strtotime("$hora + 60 minutes");

$horaNovaFormatada = date("H:i:s",$horaNova);
$s = array();

$s["title"] = $r['titulo'];

$s["content"] = $r['conteudo'];

$s["where"] = $r['onde'];

$s["startDay"] = $r['data_inicio'];

$s["startTime"] = $r['hora_inicio'];

$s["endDay"] = $r['data_fim'];

$s["endTime"] = $horaNovaFormatada;

$gc->add_event($s);


Faça as adequações para sua tabela de eventos, o endereço do feed do google, é obtido na configuração do google agenda do xml privado
A segunda opção é utilizar o API do Google Calendar

http://maestric.com/doc/php/google_calendar_api

ficcionista 5/25/2011

Here is the English translation:
There are two ways to insert events in your Google Calendar. Here's the easiest way.
Download these files:

GoogleCalendarWrapper.php

MyCurl.php
Add them to the root of your project. Ex: (htdocs/project/)
The add the following code to the After Record Added event:

include "GoogleCalendarWrapper.php";

$gc = new GoogleCalendarWrapper("username@gmail.com", "password");
$gc->feed_url = "https://www.google.com/calendar/feeds/$emailgoogle/private-$chave/basic";

$SQL = "SELECT * FROM tabela where codigo = ".$keys['id']."";

$rs = CustomQuery($SQL);

$r = db_fetch_array($rs);
$hora = $r['hora'];

$horaNova = strtotime("$hora + 60 minutes");

$horaNovaFormatada = date("H:i:s",$horaNova);
$s = array();

$s["title"] = $r['titulo'];

$s["content"] = $r['conteudo'];

$s["where"] = $r['onde'];

$s["startDay"] = $r['data_inicio'];

$s["startTime"] = $r['hora_inicio'];

$s["endDay"] = $r['data_fim'];

$s["endTime"] = $horaNovaFormatada;

$gc->add_event($s);


Adjust the code to your table of events, the Google feed URL (You can get in your calendar's private XML).
The second option is using Google's Calendar API.