Skin of Stars

Icon

Kevin Carmody on machines, media and miscellanea.

PHP Script for RSS auto-discovery and OPML file generation

Hey All,

I recently got a reasonable size list of blog URLs. What I wanted was to import all these into a feed reader (via OPML). There seemed to be a lack of conversion scripts for batch URL->find RSS link->feed reader import file (I may be wrong, please let me know if I am :) , so I made one in PHP. I guess this is like an automatic-blogroller. I have just used this as a command line script, I’m not recommending you use this in ‘the wild’ as one might say, I have made little concession to security as I had a trusted list of URLs.

There are basically three steps to this

  1. Take an input file of newline seperated URLs, in my case blogs.
  2. Find (auto-discover) associated RSS feed of each blog URL
  3. Output an OPML file that you can use to import into a feed reader

What it does:

  • Takes a well formed list of newline separated URLs of blogs and turns it into an OPML
  • If the URL source doesn’t contain a <link> to an RSS feed in the head it doesn’t add it to the OPML
  • Detects the <title> and adds that to the OPML text field, or uses the URL if <title> isn’t present

What it doesn’t:

  • Check the RSS feed is validated XML
  • Any other checking really :)
  • Come with any sort of warranty/guarantee

Some of the key functions are from Keith Devens work. Thanks.
Read the rest of this entry »

Geek Set-Up

I saw this comment on slashdot by http://slashdot.org/~Sancho and it made me chuckle. Please bear in mind that this is a *very* geeky joke.

Linux is ok on the desktop, but for servers, I really prefer FreeBSD.

Sometimes I get tired of that, and use NetBSD for a while. A short stint with NetBSD, Apache, Postgresql, and PHP usually refreshes me long enough so that I can FreeBSD, Apache, Postgresql, and PHP again.

Making your own webdev environment on Ubuntu desktop

These machines aren’t all fun fun fun, sometimes you have to use them for some more serious work. In this post I’m going to tell you how to make your own php/mysql web development environment on your own Ubuntu desktop. Once you’ve done this you won’t need to keep uploading files to your server just to check if something works.

Firstly I’d like to point to the post that originally helped me do this at webmasterview.com.

Now, time to open up our trusty terminal. It is possible to do this through synaptics, but its quicker to do it like this:

First thing is to install mysql for databases on our machine. Copy this bit of code into your terminal:

sudo apt-get install mysql-server

Next we need apache2 as our webserver. Here is the code:

sudo apt-get install apache2

Then we need to get php:

sudo apt-get install php5

There are our three basic components. Now we need to hook them together:

sudo apt-get install libapache2-mod-php5

and

sudo apt-get install php5-mysql

Now that’s just grand. We’ve now got all the elements that we need to serve files to the net. The thing is, we’re only doing this so we can work on stuff at home, in which case what we’re really looking for is an easier way to do so. What we need to do is have a public_html folder in our user directory. Perhaps now would be a good time to do that. The next step is making that work on the webserver we’ve just installed. Run this snip of code:

sudo a2enmod userdir

Then restart apache:

sudo /etc/init.d/apache2 force-reload

You should now be able to reach your home folder via http://localhost/~yourusername/

Finally we want to be able to administer our mysql databases. Though there are many good tools for doing this I still go back to the web based phpMyAdmin. Apart from the fact that it’s highly automated (which suits me just fine) it’s also a very common program to find on your paid hosting, so would also be very familiar when you go live. For the quick and dirty way of getting it up and running, download phpMyAdmin and extract to your public_html folder. Personally I rename it to something a little easier. Then rename the file within from config.example.inc.php to config.inc.php and within that file put something in the blowfish_secret field. Then all you have to do is navigate your browser to something like http://localhost/~yourusername/phpMyAdmin

addendum

If your server is going to be visible from the big bad world and this is your everyday machine then you need to turn off that user public_html stuff (it’s insecure for general use!). To do that just enter this instruction

sudo a2dismod userdir

then reload apache as before

My Twitterings....

Powered by Twitter Tools

About

My name is Kevin Carmody and I live in Oxford, United Kingdom. I am a web developer with a penchant for community sites and a pedantry for open standards.

This here is a collection of my thoughts and musings, a spot for pooling a little of what's rattling around. Thanks for taking the time to visit and I hope you enjoy your stay.