The Jayly News

I’ve been listening to radio-talk-show-host, Jay Severin for the past four or five years now, on 96.9 WTKK Boston. He’s very intelligent, insightful, always has something punchy to say, and has recently entered the world of blogging. His blog is hosted on WTKK’s website, but is hidden within a portal that you can only access by registering with the website and giving them your email, or so they’d have you think. It drives me nuts when web sites make you jump through hoops for content. You think that they’d want to make it easy, as to not discourage the user.

WTKK’s website is very poorly designed. In fact it looks like it’s built on an ASP CMS that I’ve seen before, but the name escapes me. The code doesn’t come anywhere close to validating, and the functionality is gruesome. When you finally get to the link that opens the Jayly News, it uses JavaScript to pop open a new window without the URL bar, thus hiding the URL to the page. I was able to figure out the direct URL to the Jayly News by deciphering the JS, which honestly wasn’t as hard as I just made it sound. In fact here is the said URL. This page is also riddled with invalid code, loads of JS, and tables (ugh) which makes me very unhappy. I want to be able to access the Jayly News without having to login everytime, click through three windows, and look at a design that makes me want to hurt puppies.

I wanted to see how hard it would be to automate the Jayly News on my site with valid XHTML and CSS, stripped out banner ads and images, JavaScript, and other unnecessary content. I’ve been learning the power of the cURL PHP method, which with this project, has once again proved itself useful. For this project, we just need to use the following simple lines to setup our cURL. I suppose we could setup more options, but it really isn’t necessary for this project.

$theURL = "URL GOES HERE";

// initiate curl
$ch = curl_init();

// set options for curl session
curl_setopt($ch, CURLOPT_URL, $theURL);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

// execute
$theNews = curl_eec($ch);
curl_close($ch);

I then used a series of preg_replace(), ereg_replace(), and strip_tags() to remove invalid code and unnecessary content, and replace with valid and semantic code. The hardest part was figuring out the reoccurring patterns and the best method to replace the invalid code. I won’t bother to post the code here.

I’ve been wanting to learn jQuery, so I thought this project provided a good opportunity. I found it very easy to learn and implement. Not wanting to do anything to fancy, I just made the About section slide up and down. The Jayly News is now semantic, valid, quick-loading, and pretty.

Commenting is closed for this article.

Current Entry

This journal entry was posted on August 17, 2007 at 08:24 AM. It is filed under Development. There are 0 comments. View the archives. Subscribe to the RSS feed.