hResume hKit Profile
While working on Wp-hResume (a neat plugin for adding any hResume encoded resume to a WordPress site) I needed to make a decision. The strategy I was working on hinged on the choice between either using brute force regular expressions to parse the profile page for a single site (like the competition) or to write the missing hResume profile for the hKit Microformat Framework.
The way I saw it, with regular expressions I could only build a plugin that would only work with a single site; whereas with an hKit profile the plugin could, in theory, work with any hResume encoded site. So, clearly, an hKit profile was the best option.
The only problem was that there isn't any documentation on how to actually create a profile for hKit. I don't want to go into detail on it, and to be honest I don't really remember all the details so suffice it to say that brute forcing this thing sucked. Donkey balls. It took forever and the steps needed to build a profile used a methodology I wasn't familiar with. But, after a long night of tequila I did end up putting it all together though and it works pretty nicely.
First though, here's how hKit works for pulling in a microformatted URL:
<?php include('hkit.class.php'); $hKit = new hKit; $result = $hKit->getByURL('hcard', 'http://microformats.org/'); ?>
Pretty obvious stuff; give it a URL, set the type of encoding expected (this time it's hcard) and it gives back an array with all the goodies.
To work with the new profile you have to place the profile file in the same directory as hkit.class.php. You can download the profile along with the latest version of hKit here.
The concept is the same with the new profile:
<?php include('hkit.class.php'); $h = new hKit; $url = 'http://www.linkedin.com/in/mithra62'; $h->tidy_mode = 'proxy'; // 'proxy', 'exec', 'php' or 'none' $result = $h->getByURL('hresume', $url); print_r($result, 1); ?>
The above will pull my hResume encoded info from my LinkedIn profile. Same as the original hcard example. Easy like your sister.
Now go forth and start parsing hresume encoded URLs