PHP RSS Parser – RSS Reader Class for PHP

Just had to create a quick RSS parser for PHP and thought I'd post my solution. The implementation and class follows.

$rss = new RSSReader('');
while ($rss -> hasNext())
	print_r($rss -> next());
class RSSReader {
	var $xml = null;
	var $pos = 0;
	var $count = 0;
	function __construct($feed_url) {
		$this -> load_url($feed_url);
	function load_url($feed_url) {
		$this -> load_string(file_get_contents($feed_url));
	function load_string($feed_string) {
		$this -> xml = simplexml_load_string(str_replace('content:encoded', 'content_encoded', $feed_string));
		$this -> pos = 0;
		$this -> count = count($this -> xml -> channel -> item);
	function get_title() {
		return $this -> xml -> channel -> title;
	function get_link() {
		return $this -> xml -> channel -> link;
	function get_pubdate() {
		return $this -> xml -> channel -> pubdate;
	function hasNext() {
		return $this -> count > $this -> pos;
	function next() {
		$obj = $this -> xml -> channel -> item[$this -> pos++];
		return array(
			'title' => (string) $obj -> title,
			'link' => (string) $obj -> link,
			'description' => (string) $obj -> description,
			'content' => (string) $obj -> content_encoded,
			'pubDate' => strtotime($obj -> pubDate),

Chrome Extensions: History Button, Extensions Button, Downloads Button

I just created some very simple extensions for Chrome shortly after I taught myself how to create extensions.

As I said, they're VERY simple, but I find them useful, so I figured it wouldn't hurt to share them.

Each extension is a simple lightweight extension that adds a shortcut button to your browser for quick access to your history, extensions, or downloads. It either opens a new tab, or switches to the respective tab if you already have it open in a tab you're not using.

You could nearly accomplish the same thing if you made a bookmark, but this assures you won't open multiple tabs and I like to keep some things separate from the bookmarks bar.

Chrome Extensions Button

Chrome History Button

Chrome Downloads Button


MySQL Select Count Distinct – Counting and Identifying Duplicate Records


Looking for a [relatively] quick way to identify duplicate records in a table and list how many records there are for each duplicate? Look no further.

In my case, I’ve got a table named Searches which tracks queries on one of my sites. I wanted to check the top queries, so I used this SQL statement:

SELECT COUNT(*) AS repetitions, Query
FROM Searches
HAVING repetitions > 1
ORDER BY repetitions DESC;

There you have it. A simple, effective way to count and label duplicate records.

30 Google Wave Invites

[ad] [ad]

Google Wave logoI've got 30 more Google Wave invites to give away. Leave a comment with your email and I'll send them. First come, first serve.

This is actually a nomination and it may take a little while before you get your actual invite.


From now on, you must retweet the bitly URL ( on twitter and reply to me in order to get an invite.

Example tweet:

@xoise Free Google Wave invites: #GoogleWave

Then put a comment in the comment section and don't forget your email (doesn't have to be public).

How to retrive Yahoo Backlinks count with PHP

Here's a simple script to retrieve the approximate number of backlinks Yahoo has for a site. The function and how to call it follows:

function get_yahoo_backlinks_count($url) {
	$appid = ''; // get this from
	$url = "$appid&query=site:$url&results=1";

	$ch = curl_init();
	curl_setopt($ch, CURLOPT_URL, $url);
	curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
	curl_setopt($ch, CURLOPT_REFERER, '');
	$response = curl_exec($ch);

	$xml = simplexml_load_string($response);
	return $xml -> attributes() -> totalResultsAvailable;

echo get_yahoo_backlinks_count('');