views:

86

answers:

3

I saw a post about player stats and data. All I want is a list of NFL players. Is there an easy way to find this data for free? Will I have to scrape it off a website or do it by hand?

If scraping is the route to take, can someone offer documentation, or library to help do this with php?

A: 

There may be feeds out there of this type of information. I would first try yahoo.

If you can't find anything, you can scrape it as suggested. For PHP you'll want to look at cURL: http://us3.php.net/curl

cURL will get you the data, from there you'll need to parse it. That's a whole other ballgame.

Patrick
Where would I find the data feed on yahoo? Can you provide a link?
Bob Cavezza
pmckenna
A: 

I'd imagine that there aren't many places that are providing this information for free. Mainly because people are willing to pay money for an accurate data feed that's easy to parse. Your best bet is screen scraping a site that has this information, but be aware of the inherent problems with screen scraping and build in good error handing.

The most likely problems you'll come across are:

  1. The site may realise you're screen scraping, and block your servers IP
  2. The site may change the HTML code around the data and your scraping may not work anymore

Hope that helps.

pmckenna
I think the data I need is small enough that I can just copy and paste the data and parse it instead of a curl.
Bob Cavezza
A: 

Using cURL for this is a great idea..though it's an incredibly powerful library with a ton of functionality to learn. Here's a good article on that: http://net.tutsplus.com/tutorials/php/techniques-and-resources-for-mastering-curl/

One thing to add is that you may want to store the data that you scrape so that you are not constantly hitting that URL and risking an IP block. Writing to a MySQL table seems like a good idea with tabular data like this

Matt Schweers