Stock Quotes From Yahoo in RSS or CSV

UPDATE: The location of the CSV file has changed since this post was originally written.

I’ve been trying to find a way to get stock quotes delivered to me (via email or RSS) for too long now. It turns out I just wasn’t searching very well because a solution was made back in 2005.

Check out the freely available script at TC’s Blog that generates a custom RSS feed based on the stock symbols of your choice.

As with most things, I decided this approach was slight overkill for my needs so I cut into the meat of TC’s script and took out the part I needed most. His script runs off of Yahoo! Finance’s little known ability to deliver quotes in a CSV file.

So here’s the URL you need:

http://quote.yahoo.com/d/quotes.csv?s=SYMBOL&f=sl1d1t1c1ohgv&e=.csv

If you toss that into fopen or curl (or whatever your weapon of choice is) and then parse the result using fgetcsv you’ll be good to go. Here’s a breakdown of the array that fgetcsv will return.

array[0] = Symbol
array[1] = Last Price
array[2] = Date
array[3] = Time
array[4] = Change
array[5] = Open Price
array[6] = Day High Price
array[7] = Day Low Price
array[8] = Trade Volume

Keep in mind that Yahoo! doesn’t give you real-time quotes. Their information comes on a twenty minute delay or so. Hopefully, using TC’s RSS script or just going straight to the CSV source will help you out.

October 29th, 2006 | PHP, Programming | 0 Comments

Another Side Project: Michigan Sports Report

A few months back, in an attempt to keep on top of the news about the stumbling Indians, I built a site called the Ohio Sports Report. It’s simply a news aggregator made for sports teams in Ohio. The site updates throughout the day with links to articles in all the major local sports publications and more.

It’s been running so well that I’ve started another site, the painfully obvious to predict Michigan Sports Report. It’s the same concept as the Ohio Sports Report and runs on the same backend.

Check it out if you’re one of those Tigers fans that are all the rage now.

Michigan Auto Insurance free quotes

October 17th, 2006 | Side Projects | 0 Comments

JavaScript, .closed and Windows Update KB918899

I maintain a slightly aging Intranet application and came across a JavaScript “Permission Denied” error on a page handling pop-up windows. I know pop-up windows aren’t very Web 2.0 but you can save your evangelism for another day. In defense of all things flashy and new, the app is slowing migrating to AJAX. Very slowly.

Anyway, after some light searching I came across a thread at thescripts that goes into some detail on the problem before digressing into a programmer slapfight.

Let me try and save you the trouble of wading through that mess…
(more…)

October 11th, 2006 | JavaScript, Programming | 0 Comments

Tan Ling Wee’s New Calendar

After my post on the search for a decent JavaScript datepicker, I heard back from Tan Ling Wee:

Thanks for the compliment on the datepicker. I’ve rewritten the datepicker to make it more flexible and renamed it to Sparrowscripts datepicker, but have started charging a fee of $10 per download (unlimited use though).

Check out SparrowScripts for the datepicker and several other projects you might find useful.

October 9th, 2006 | JavaScript, Programming | 0 Comments

Charts & Graphs Using PHP & Flash

If you’re looking for a simple way to add charts and graphs with PHP you might want to check out PHP/SWF Charts. It’s a stupid-easy to use Flash based system that receives data from PHP includes.

There’s a free version with slightly limited features, but a full-featured single license is only $45 and it’s good for one domain name and all its sub-domains.

I prefer PHP/SWF Charts over alternatives like JpGraph.

October 7th, 2006 | Flash, PHP, Programming | 0 Comments

PHP & PDFs

I’ve been meaning to write about making PDF files with PHP for the last week. Then today Jonathan Snook posted a link to a Zend article on PDF generation that uses only PHP and no external forces. Now I’ll throw my two cents in.

It’s an ok solution but there are some other ways to go for those of you not afraid to install some server-side programs, run third-party libraries or are looking for a free alternative to PDFlib.

FPDF

I’ll start with my personal preference to this problem. FPDF gives you total control of your PDF layout with some pretty easy to learn functions. It doesn’t require any additional software to run. You just upload the library to your server, include a file in your script and away you go. The downside to FPDF is that every piece of the PDF must be layed out yourself in code. There is no HTML converter packaged with FPDF.

HTML_ToPDF

HTML_ToPDF takes standard HTML ouput from either a file or an output buffer and turns it into a PDF with pretty accurate results. The secret behind HTML_ToPDF is that it is essentially a wrapper for two command-line programs. You need to be able to correctly install html2ps and ps2pdf before you can get HTML_ToPDF to work.

For a good read on HTML_ToPDF check out this article: MS Windows (and HTML_toPDF) made me a masochist.

HTML 2 PDF

HTML 2 PDF runs in the same way HTML_ToPDF works by taking standard HTML and converting it into a PDF document for you. The difference is that HTML 2 PDF runs off of the above mentioned FPDF library so it doesn’t require any difficult server side installations. The main problem for me with this library is its lack of support for nested tables. As unhip as nested tables are with the Web 2.0 Elite, HTML 2 PDF not supporting them is a deal breaker for me.

October 6th, 2006 | PHP, Programming | 0 Comments

A Decent JavaScript Calendar

There probably isn’t a web app on earth that doesn’t require some kind of date input. Everyone has their own way of handling this: dropdown menus, a simple text box, multiple text boxes or the dreaded popup calendar.

Most popup calendars are either absolute garbage or too complex.

The Fuushikaden calendar, written by Tan Ling Wee in December of 2001, is probably the best answer to this problem I’ve seen. The calendar pops in the page instead of a new window and can be customized with CSS. It’s very nicely done.

Unfortunately, it’s nearly impossible to find online anymore. I only dug up one good URL: http://www.theopensourcery.com/jscalendarx.htm that explains things in any kind of detail. While all that detail is nice, the site doesn’t have the code (and images) readily available for download. You have to do a bit of digging. Internet.com’s JavaScript site used to have a page for it but that’s gone 404.

The developer of this calendar has officially gone AWOL from the web for a few years now. The copy of the Fuushikaden calendar I use is so heavily modified and trimmed for my own use at this point that I’d rather find the original.

If anyone knows of a site that has the original code and images of this calendar let me know. In the meantime I’m going to keep looking.

October 5th, 2006 | JavaScript, Programming | 0 Comments