Myspace Gigs Parser

Update: This PHP class that I built has gained a little momentum on the interweb. If anyone has actually used this class on their site and would like to have a link back from us here at DCSHB.com then feel free to email the webmaster for details.

Addendum: If you're mildly famous (or the webmaster for someone who is) and use this PHP class then please consider signing, scanning and emailing the webmaster an 8x10 headshot signed "Dave Coulier Shaves his Balls".

Thousands of bands, musicians, DJs and comedians maintain their concert calendars through their Myspace pages. Unfortunately, Myspace has never offered any form an an API to get access at any of their data. So, that makes people like me come up with creative ways to pull and parse publicly available Myspace pages in order to populate our sites.

Therefore, I have come up with a simple utilitarian PHP class to pull and parse someone's Myspace page. The Myspace Gigs Parser is simple to use, all you need is the simple Myspace URL for the band or comedian you wish to parse, e.g. http://www.myspace.com/bobsaget. You pass the URL to the class and out comes an array of all the Upcoming Gigs.

To test this parser you can try some of the links below or type in the last part of the Myspace URL into the text box in the upper right corner. Try your band's page or try your favorite band.

Examples:

Let's show you a quick example of how to utilize the the PHP Myspace Gigs Parser

$url = "http://www.myspace.com/bobsaget";
$gigs_parser = new Myspace_Gigs_Parser($url);
var_dump($gigs_parser->gigs);

The gigs array will either contain all the gigs parsed off that Myspace page, or bool(false). To utilize, just use a foreach() loop and

foreach($gigs_parser->gigs as $gig){
  $time = $gig[0] . ' ' . $gig[1];
  echo date('D, j M Y g:iA', strtotime($time));
  echo '<br />';
  echo $gig[2]; echo '<br />';
  echo $gig[3]; echo '<br />';
}

The data comes in an array and these are the following pertinent indexes.

[0] month day year of gig, format: date('M j Y')
[1] time of gig, format: date('g:iA')
[2] venue of gig
[3] city state of gig

That is pretty much all you need to know about how to use the Myspace Gigs Parser. Just keep one thing in mind when utilizing this class, I built it quickly so don't be critical of how I did my parsing. The only thing I regret is that I didn't notice that have a div with the id of "profile_bandschedule". I could have perhaps cut down some of the string searching time by finding that node first and searching from there. The other thing that could be improved is the final algorithm loops through all data nodes and splits them up into batches of four. This could probably be done quicker with some simple math and array_split() but I chose not waste my time any more than I already have.

And now, what you all have been waiting for... the source code:

Upcoming Shows

myspace.com/

Fri, 14 Aug 2009 9:00PM

Borgata Music Box
Atlantic City NJ

Sat, 15 Aug 2009 8:00PM

The Capital One Bank Theatre at Westbury
Westbury NY

Sat, 24 Oct 2009 8:00PM

Red Robinson Show Theatre Coquitlam, BC, Canada
Coquitlam (Vancouver), BC

In the Press

John Stamos hosts the Roast of Bob Saget The Roast of Bob Saget finally aired and boy was it great. Stamos hosted and was pretty funny but I'd have to say my favorites were Cloris Leachman and Gilbert Gottfried. I now know how to make an "asshurts" which is something I've always wanted to know how to do. Norm MacDonalad and Brian Posehn were a little awkard and Jon Lovitz just called him gay for five minutes. Overall, it was worth every minute of my life.

Subway sign in New York with pictures of the men of Full House with cirlces with a slash through them like a no smoking sign.

The New York L Subway was revamped recently with new signage. Click through on the Read More link to find out the full story. — Read More...
John Stamos was returning on a flight from Chicago when another first class passenger attempted to strike up a conversation with him while he slept. Police were called but no files were charged. This story was first broke by KNBC out of LA but the E-Online story was the best in my opinion, especially with the following quote...

"which, if she'd ever paid attention to Michelle Tanner's attempts to do the same thing on Full House, she'd know Uncle Jesse wouldn't appreciate."

I love entertainment news. — Read More...
Bob landed himself a new gig as the Man in Chair for the Broadway production of The Drowsy Chaparone. He got into costume recently for a photo shoot for an ad campaign for play and Broadway.com was there to take photos of Bob working his magic. Bob will be appearing in the musical for a four month run. — Read More...
In more exciting news, Bob Saget is performing in Phoenix tomorrow night and the Arizona State Press has published a great interview with Bob. — Read More...
The Washington Post's Tom Shales gave Bob Saget's HBO special a scathing review today. Unforunately for Tom, everything I read in his review just makes me wish I would have shelled out the extra $10 for HBO. Luckily, the DVD comes out on Tuesday. — Read More...
Bob Saget talks to LA Times writer Mike Flaherty about his HBO special, the Aristocrats, Les Moonve and the Olsen Twins. — Read More...
Bob Saget's name was brought up in an investigation into a hate crime that happened in Phoenix, AZ. No charges have been filed. — Read More...
In case you missed it, the Seventh Season of Full House was finally released on Tuesday (Aug 7th) and you can pick it up for $20 bucks off Amazon right now. It's worth every penny as Ultimate Disney will let you know in their amazing review.Read More...
Candace Cameron-Bure

BuddyTV has been running some great What Are They Up To? articles and have recently ran one about Dave. In the article comments sillyd casually reminds us that Dave coined "cut it out" on the short lived Out Of Control.

The same day they ran Dave's story they conveniently ran a What Are They Up To? on Full House cast member Candace Cameron-Bure who is looking as fabulous as ever in this picture stolen from her website. — Read More...

Bob Saget theorizes what the last 24hrs would be like before his death. — Read More...
John Stamos is caught playing guitar with the Beach Boys but not living the Rock and Roll lifestyle as he reportedly touched no booze the entire night. — Read More...
Bob Saget gives a quick interview to The Phoenix in Boston, MA. — Read More...