1 | 2 | 3

1 - 5   [14]

Latest WCAG Working Drafts

Relates to Web Standards and Accessibility

The latest batch of WCAG working drafts were made public yesterday:

Posted on Nov 20, 2004 at 20:04:55. [Comments for Latest WCAG Working Drafts- 0]

PHP COM for Outlook to Access

Relates to PHP and Basic, COM

I had an urgency earlier today to produce a script to extract details from the body of a number of emails and put the information into an Access database. For any seasoned VB programmer this would seem like a trivial task I am sure, but having become quite accustomed to using the PCRE library to manipulate and extract text, the thought of becoming embroiled in text searching subroutines using VBA's InStr and Mid functions quickly had me concocting alternatives. If only I could get the body of the emails into some PHP arrays and use the well-seasoned preg family to get the information I needed. Time to call on the Windows COM extension once again.

In fact, getting to an email item is considerably less cumbersome than working with Excel via PHP COM. The messages were stored in a subfolder of the Inbox called Enquiries.


$outlook = new COM("Outlook.Application") or die('….');
$ns = $outlook->GetNamespace("MAPI");
$inbox = $ns->GetDefaultFolder(olFolderInbox);
$subfolders = $inbox->Folders;
while ($folder = $subfolders->getNext()) {
   if ($folder->Name == "Enquiries") {
     break;
   }
}

So now $folder references the subfolder Enquiries and I just needed to cycle through each mail item in this folder to grab the body.


$mail = $folder->Items;
while ($item = $mail->getNext()) {  
  $temp = array();
  $temp['body'] = $item->Body;  
  $temp['date'] = date('d/m/y', $item->ReceivedTime);
  $enquiries[] = $temp;
}

While I was about it, I also grabbed the date each message was received. Conveniently the PHP COM returns this property as a Unix(!) timestamp so it can be fed straight into date() to get the required output.

A few regular expressions later and the data was transformed into an SQL string ready to feed into MS Access. Sticking with the Windows theme, the inbuilt ODBC functions seemed the best bet for this, once Null values had been handled and a System DSN established.

I am in no way promoting this as a method to go about transfering Outlook data to Access. It just demonstrated the flexibility PHP can offer. I needed to do some heavy duty work on the body text to create the field/values I needed and since PHP is the language I use on a daily basis, I found it less time consuming to build this bridge than to dust off and start trawling through old VBA references.

This is one of many areas where Thunderbird shines for me - emails stored in text format ready to be grep'ed.

Posted on Nov 19, 2004 at 03:37:36. [Comments for PHP COM for Outlook to Access- 0]

Glimpse of the Leonids?

Relates to Star Gazing

Once again, the Leonids herald an overcast skyline. Conditions were looking favourable an hour ago, but the clouds have returned without a glimpse of a meteor. Maybe next year….

Posted on Nov 19, 2004 at 02:57:34. [Comments for Glimpse of the Leonids?- 0]

UK2K Up For Grabs

Relates to Peregrinations and Surfing

Back in 2001, I joined forces with Donny at Still Stoked Longboard Skates to cut more than 50 hours of surfing, skating and travel footage aroung the British Isles into the 2 hour feature UK2K, A New Wave Rising. The film was the first pure British Longboarding film to be released in the modern era of longboard surfing, and following some rave reviews it rapidly became a cult classic.

It is hard to recommend a film that I was actively involved in making, but even now I find it as watchable as the first time the entire cut was run, backed by an impressive soundtrack - and an entertaining interlude featuring myself and fellow bore riders! If you missed it the first time round, one of the original copies of A New Wave Rising, which are now becoming very rare, is currently available to bid on at Ebay.

Posted on Nov 14, 2004 at 22:08:37. [Comments for UK2K Up For Grabs- 0]

Kingsholm for the Rugby

Relates to Peregrinations

I finally made my first trip, in 26 years of living in the area, to Kingsholm last night to watch the Cherry and Whites! The Wizard had acquired seats in the grandstand from his parents who had decided to trade their season tickets for the warmth of Sky Sports. Despite a well contested match in which Gloucester maintained considerable possesion, the Wasps stronger defense and penetrating attack gave them a 27 - 17 victory. The atmosphere was electrifying in the sold out 13,000 seat stadium, with the roar from The Shed making Dallaglio, Dawson, Greening, Shaw and co less than welcome.

Almost made me want to pick up a rugby ball again…!?

Posted on Nov 13, 2004 at 14:58:57. [Comments for Kingsholm for the Rugby- 0]

Breadcrumbs Trail

[ Home ] -> TW Blog -> Archives for November 2004
Site Map

The Severn Solutions website achieves the following standards:

[ XHTML 1.0 ] [ CSS 2 ] [ WAI AA ] [ Bobby AA ]

Page compiled in 0.007 seconds