[uf-dev] hCard to Gmail Converter

Jamie knight jammie.knight at gmail.com
Thu Feb 8 13:55:05 PST 2007


hiya,

This is my first message to this list so I hope I don't make any
mistakes! If I do please be gentle!

A few months ago, I was clicking around with operator, trying to find
a way to get a hCard into gmail, as gmail is the main e-mail service I
use. After a lot of looking around and a bit of searching I found that
there was a process which I could use to bring hCard formatted data
into my gmail account.

This process was quite simple; I have documented it more fully on my
blog post entitled hCard to Gmail
(http://jkg3.com/Journal/74/hcard-to-gmail) . In short, I used one
service to convert the hCard to a vCard, then another service to
convert this vCard to the CSV file the gmail contact importer
required.

>From here, I sought a way to automate this process. I downloaded
copies of both scripts (they are both open source) and proceeded to
hack them together. This was my first time with XLST, and my first
time producing a  CSV file within PHP, so after a lot of learning, I
managed to "functionize" the CSV producing part of the code, and place
it into the hCard to vCard code instead of it producing a file.

I tried to upload this to my server, then I discovered that there was
a different XLST service on my host to my local testing sever, after a
few hours of fiddling around I decided that I did not know enough
about XLST to be able to fix this problem, and instead required
something that I could understand easier.

So, my next move was to find a "simpler" way to extract my hCard data
into a php array. Luckily for me, there was an exact tool for this
staring me in the face. hKit

hKit for those who are unaware, is a very useful bit of code by Drew
McLellan which take a URL as input, and produces a PHP array of hCard
objects as an output. find out more about hKit at
http://allinthehead.com/hkit/

After downloading and playing with this script, I rewrote my
converter, and produced a service which works. The process is still
hCard – vCard – CSV I relise that this is not the best way to proceed
so I am now learning more about producing gmail formatted CSV files.

More information on the service (and a bookmarklet) is available at
www.jkg3.com/stuff and i would welcome any input form the community
regarding further development of this service.

Thanks

Jamie Knight



More information about the microformats-dev mailing list