arrow-left arrow-right brightness-2 chevron-left chevron-right facebook-box facebook loader magnify menu-down rss-box star twitter-box twitter white-balance-sunny window-close
Integrating with your weblog
1 min read

Integrating with your weblog

As I touched on yesterday, I moved my ‘linkblog’ over to and was working on a way to merge those bookmarks with this site. After thinking about the various ways to do this, I came across an HTML generator on the site. It certainly isn’t the prettiest solution, but I figured it was something I could get up and running in a matter of minutes.

The basic idea is that will return a chunk of HTML as per the arguments you supply it. The URI for my request looks like this:



After figuring out the syntax it was just a matter of coming up with a way to pull it off the server. I decided to use Perl and the following is all the code that was needed. [Note that this could be done in one line with something like curl: curl https://address -o file.txt]

use LWP::Simple;
$bits = get;
open(FILE, >/path/to/the/file/you/want/to/write/to);
print FILE $bits;

You could obviously use PHP or JavaScript to yank this information down each time the page is loaded, but why hit the server every time someone requests a page from you? Instead, just create a cron job that runs the above script every 15 minutes or so and then include the returned file in pages that are requested by your users. I use PHP for the include:

<?php include('/path/to/file'); ?>

Finally, you’ll need to modify your CSS so that the text you’ve pulled down from gets styled inline with the rest of your site.

Like I said, there are a million different ways to bring your bookmarks into your site, but this seemed like the simplest to me. If I decide on a different method in the future, I’ll be sure to outline instructions for that method here.

You've successfully subscribed to Justin Blanton.
Success! Your account is fully activated, you now have access to all content.