Forum Moderators: coopster

Message Too Old, No Replies

PHP Stock Quote

How can I automate my stock indices?

         

ssskaya

11:04 am on Mar 22, 2004 (gmt 0)

10+ Year Member



I am using an external .js file to publish major stock indices, but this, of course, require manual update every day.

How can I get these numbers (just index level and the change) via a php script and do not bother manually updating it every day?

dcrombie

1:38 pm on Mar 22, 2004 (gmt 0)



You can set up a 'cron job' to run daily (or hourly) and use curl to 'rip' the data from the web. PHP has a curl library [php.net], or you can call it as a system command.

ssskaya

7:36 pm on Mar 22, 2004 (gmt 0)

10+ Year Member



I never did that before.

Is it easy to learn?

jatar_k

5:38 pm on Mar 23, 2004 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Welcome to WebmasterWorld ssskaya,

curl is not too hard to learn. Then you just need to grab the specific data from the page and store it wherever you need to (db?).

Then the script that does the scraping can be scheduled via cron [freebsd.org] (this is freebsd specific but most of it will apply to others as well).