Adding stock information to a site?

jag5311's picture

They have: 202 posts

Joined: Jan 2002

As with all my posts have had to do with the site i am working on, The Seemac Webpage, i want incorporate some information where the visitor can see the latest stock prices of a couple particular stocks on my site. Not real time, but maybe updated every few minutes. I would like to have it up near the top of the page, to the right of the date, saying something like this for the two companies

Willamette - WII - 46.13
Georgia Pacific - ?? - ????

just something where people in the forestry industry who visit the website could just have something to notice about forestry stocks. Anyone know where i can find something like this. Whether its a cgi script, java or whatever.

thanks

bryan

detox's picture

They have: 571 posts

Joined: Feb 2001

I know that there are XML solutions to this that take info from the Yahoo stocks page (i think it is yahoo anyway). I do not know whether or not you can take specific ones, though I doubt that would be too hard, alkl you would have to do is define a criteria to grab the info.

I will have a look if there are easier ways. There are obviously sites that list the info for a subscription but I take it you want it for free?

They have: 40 posts

Joined: Jul 2001

our intranet has something through a company called Screaming Media. You'd proabably have to pay pretty big dollars though...i'm not really sure. it's pretty damn cool though.

PUNKK

They have: 601 posts

Joined: Nov 2001

If you're familiar with Perl you could use the Perl Module Finance::YahooQuote and/or Finance::YahooChart. These are two excellent modules that will grab a stock quote from the Yahoo database and make it available for use on your page.

http://search.cpan.org/doc/DJPADZ/Finance-YahooQuote-0.17/YahooQuote.pm

http://search.cpan.org/doc/DJPADZ/Finance-YahooChart-0.01/YahooChart.pm

If you need more information on how to incorporate these into your pages, pop over to the Server-Side Scripting forum and I'll try my best to help.

Rgds

- wil

jag5311's picture

They have: 202 posts

Joined: Jan 2002

that first one would be perfect, but i don't understand how i would incorportate that into my site. It sounds like that would be included in a script of some kind, instead of adding that line of code to the html section of my site. If you can help more, that would be wonderful.

thanks

bryan

They have: 601 posts

Joined: Nov 2001

OK. Can you find out for me if your host allows you to include SSI calls (server side inclues) into your pages. These pages are commonly renamed with an extension of .shtml.

If they can do this, and your server supports perl, then I'll knock up a quick script for you. You'll then be able to just add an extra line into your HTML code that calls the script and then the line should be replaced by the stock quote price.

Shouldn't be too difficult, although never tried this module. Let me know if your host supports SSI pages and Perl, and then I'll get to work Smiling

- wil

jag5311's picture

They have: 202 posts

Joined: Jan 2002

Cool. Yes it does. ALl my pages in my gamecubecheats.net website are renamed to .shtml because i have 2 scripts running using ssi. If you do this, can you try to configure it like this

Stock name
Stock Symbol
stock price

with those one underneath each other?

something like that, maybe so i can include the line of code into my site and i can change the color of one of my tables so it isn't just plain text. do you know what i mean.

thanks

bryan

They have: 601 posts

Joined: Nov 2001

Sure, I'll work on this when I'm back in my office tomorrow. I'll post some code to by the end of the day tomorrow, probably by lunch time. Let me know what stock symobls you want.

- wil

They have: 601 posts

Joined: Nov 2001

OK. Here goes...

At the moment, the script outputs the following information (from what you asked in your previous message):

    1 Company Name
    0 Symbol
    2 Last Price
'
I'll have to email you the code as this forum doesn't allow attachments - so please send me a message or email me using the following address so I can send you the script.

[email protected]

I'll give you a brief idea of how to use this here. It should be very simple and straight forward.

1. Upload the file "quote.pl" to your cgi-bin directory using ASCII transfer mode on your FTP client.
2. CHMOD (change permissions) of this file to 0775.
3. Place the following SSI command in the SHTML file you want the quote outputted, replacing the word "TYC" for the symbol you wish to output. And replacing /path/to with the actual path to where you put your script - most probably /cgi-bin/quote.pl

<!--#include virtual="/path/to/quote.pl?symbol=tyc" -->
'
Now reupload your SHTML file and when accessed it should output your stock quote.

Hope this helps.

- wil

They have: 601 posts

Joined: Nov 2001

OK. I might not be in tonight to answer your email, so if you want to check it out, go to:

http://cgi.fbagroup.co.uk/quote/

Your best bet is to download the archive quote.zip. If you don't have a ZIP unpacker such as Winzip on your machine, I've left the seperate files there for you to download.

Hope this helps.

- wil

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.