Hardware Reference
In-Depth Information
If you're not comfortable with the XML processing language XSLT, then a simple PHP loop can be written to
parse the ICAL file, like this:
$regex = "/BEGIN:VEVENT.*?DTSTART:[^:]*:([^\s]*).*?SUMMARY:([^\n]*) «
.*?END:VEVENT/is";
preg_match_all($regex, $contents, $matches, PREG_SET_ORDER);
for($i=0;$i<sizeof($matches);++$i) {
// $matches[$i][1] holds the entire ICAL event
// $matches[$i][1] holds the time
// $matches[$i][2] holds the summary
}
The date format in ICAL can be stored in one of three formats:
u
Local time
u
Local time with time zone
u
UTC time
You need not worry about which version is used, as you can use the existing PHP library functions, such as this:
$prettyDate = strftime("%A %d %b %Y.", strtotime($matches[$i][1]));
N Be warned that the XML version of your data includes back references to your calendar, which include
your private key.
Note
Naturally, other online calendar applications exist, offering similar functionality. This version is included as a
guide. But having gotten your data onto your own machine, you can trigger your own e-mail notifications, send SMS
messages to countries currently unsupported by Google, or automatically load the local florist's web page when the
words grandma and birthday appear.
Accessing Webmail through POP3
Most of today's workforce considers e-mail on the move as a standard feature of office life. But for the home user,
e-mail falls into one of two categories:
u
It is something that is sent to their machine and collected by their local client (often an old
version of Outlook Express); consequently, it's unavailable elsewhere.
u
It is a web-based facility, provided by Yahoo!, Hotmail, or Google, and can be accessed only
through a web browser.
Although both statements are (partially) correct, it does hide extra functionality that can be provided very
cheaply. In the first case, you can provide your own e-mail server (as I covered in Chapter 5) and add a webmail
component using software such as AtMail. This allows your home machine to continue being in charge of all your
mail, except that you don't need to be at home to use it.
Alternatively, you can use getmail to receive your webmail messages through an alternate (that is, non-web)
protocol. First, you need to ensure that your webmail provider supports POP3 access. This isn't always easy to find or
 
Search WWH ::




Custom Search