Solved

RSS Feed import to other Calendar apps

Posted on 2011-02-22
5
2,484 Views
Last Modified: 2014-11-12
I have an RSS feed that is based on an internal calendar database app.

What's the best way to have people import that RSS feed into their own calendars regardless of what app they are using i.e. MS Outlook, Google Calendar, Lotus Notes etc...
I have attached the RSS feed page image.
calendar-rss-feed.bmp
0
Comment
Question by:awarraic
  • 3
  • 2
5 Comments
 
LVL 108

Accepted Solution

by:
Ray Paseur earned 500 total points
ID: 34961030
That's a good question and I have never tried to make an RSS feed into a calendar application - they are just two separate things.  However there may be a way by providing a link to a vCal file.

The <item> tag has a place for a link.
http://cyber.law.harvard.edu/rss/rss.html#hrelementsOfLtitemgt

This link could point to a script on your calendar application that generates a little vcal file, something like this.  The script is in the code snippet.
http://www.nationalpres.org/NPC_calendar_vcal.php?k=2945

Sorry it's not very pretty (legacy code from many years ago) but it works for our needs.

HTH, ~Ray
<?php // http://www.NationalPres.org/NPC_calendar_vcal.php
error_reporting(E_ALL ^ E_NOTICE);
$config_page = $_SERVER["DOCUMENT_ROOT"] . '/' . 'config.php';             require_once($config_page);
$cal_funcs   = $_SERVER["DOCUMENT_ROOT"] . '/' . 'calendar_functions.php'; require_once($cal_funcs);
if (bad_robots()) { die(); }



$_key        = $_GET["k"];
if (!is_clean_numeric_string($_key)) die("Bad Key");

$filename = "NPCEvent" . $_key . ".vcs";
header("Content-Type: text/x-vCalendar");
header("Content-Disposition: inline; filename=$filename");


$sql = "SELECT * FROM $calendar_table WHERE _key = $_key LIMIT 1 ";
if (!$result = mysql_query($sql)) { fatal_error($sql); }
$num_rows = mysql_num_rows($result);

if ($num_rows == 0) {
    echo "Sorry, the <b>Event Key $_key</b> is not found in the $calendar_table data base.<br /><br />\n";
    echo "Please report this error to the NPC Communications Office.<br /><br />\n";
    die("Sorry, Unable to add to your calendar.");
}
if ($num_rows != 1) {
    echo "SQL $sql<br>";
    echo "RESULT $result<br><br>";
    echo "The <b>Event Key $_key</b> appears to have $num_rows data base entries in $calendar_table (yikes!)<br />\n";
    echo "Please report this error to the NPC Communications Office.<br /><br />\n";
    die("Sorry, Unable to add to your calendar.");
}

$calendar_array = mysql_fetch_assoc($result); 

extract($calendar_array);

$loc = trim($location);
if ($loc  != '') { $loc = '=0D=0A=Location: ' . $loc; }

$poc1 = trim($poc1_name .' '. $poc1_phone .' '. $poc1_email);
if ($poc1 != '') { $poc1 = '=0D=0A=Contact: ' . $poc1; }

$poc2 = trim($poc2_name .' '. $poc2_phone .' '. $poc2_email);
if ($poc2 != '') { $poc2 = '=0D=0A=Contact: ' . $poc2; }

$pocw = trim($poc_url);
if ($pocw != '') { $pocw = '=0D=0A=WWW: ' . $pocw; }

$poc = $poc1 . $poc2 . $pocw;

// CALENDAR TOLERATES END TIMESTAMPS WRONG OR OMITTED - VCAL DOES NOT
$vcal_dtstart = date('Y-m-d\TH:i:sO', strtotime($start . " -1 hour"));
$vcal_dtend   = date('Y-m-d\TH:i:sO', strtotime($end . " -1 hour"));
if ($vcal_dtend < $vcal_dtstart) { $vcal_dtend = $vcal_dtstart; }


?>BEGIN:VCALENDAR
VERSION:1.0
PRODID:NPC Online Calendar
BEGIN:VEVENT
SUMMARY:<?php echo "$title" . PHP_EOL; ?>
DESCRIPTION;ENCODING=QUOTED-PRINTABLE:<?php echo "$details" . "$loc" . "$poc" . PHP_EOL; ?>
DTSTART:<?php echo $vcal_dtstart . PHP_EOL; ?>
DTEND:<?php echo $vcal_dtend . PHP_EOL; ?>
END:VEVENT
END:VCALENDAR

Open in new window

0
 

Author Comment

by:awarraic
ID: 34974134
@Ray, how does this code work?
Do I have to add config.php and calendar.php files?
What's the $_key?
0
 
LVL 108

Expert Comment

by:Ray Paseur
ID: 34974761
No, you do not have to add the config or calendar scripts from our framework - just substitute your own versions.  The only thing this script calls from the framework are error handlers, etc.  Should be pretty easy to figure out.

$_key is the key number for the row in the calendar table.  See line 9 where it is acquired and line 17 where it is used.
0
 

Author Closing Comment

by:awarraic
ID: 34979245
Thanks Ray. First time I heard about this Vcal thing, pretty cool. Once I created .ics file; I just dragged and dropped into lotus notes and all the events were in :)
Thanks again for all the help.
0
 
LVL 108

Expert Comment

by:Ray Paseur
ID: 34983979
Thanks for the points.  I love the vCal.  There is a more advanced version of the standard now, but the older standard works perfectly and never confuses anyone.  Best regards, ~Ray
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Problem to run file 9 105
use of cookies and regulations 1 77
cookies analysis tools 2 73
Query a different sheet based on whats in a cell 5 41
Learn new improvements released by Google for Google Calendar. Noted in this article are simple tips and tricks that can make your everyday use of Google Calendar better.
SASS allows you to treat your CSS code in a more OOP way. Let's have a look on how you can structure your code in order for it to be easily maintained and reused.
This Micro Tutorial will introduce a Google tool, which is a great way to learn more about dimensions in metrics in Google Analytics, even if you use the interface or the API.
This Micro Tutorial will demonstrate how marketers can use the Mobile Emulation Tool in Chrome Developer Tool. This will let you preview your site on any mobile device.

863 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

28 Experts available now in Live!

Get 1:1 Help Now