Jump to content


This topic is now archived and is closed to further replies.


displaying contents of remote csv file

Recommended Posts


Here is what I am trying to do, but I cannot find a tutorial on how to do it since I am dealing with a CSV file with multiple rows but only one column

When a user visits the page I want php to grab
[a href=\"http://finance.yahoo.com/d/quotes.csv?s=SOFO+LNUX&f=l1\" target=\"_blank\"]http://finance.yahoo.com/d/quotes.csv?s=SOFO+LNUX&f=l1[/a]

Which contains

This is expandable (i can add more symbols to the URL) so what I am trying to do is make a script that will fetch that file, grab each line assigning it a variable in sequence to later print, ie $stock1 $stock2 etc so later on in my table where I want to print the information I only have to add
[code]<?php echo "$stock1" ?>[/code]
to get it to display the data, in this case to simple print out SOFO_Current_Price

If anyone knows a good way to do this I would appreciate it. Current Price is all I need and I am trying to write this with as little code as possible, which should be possible, I just don't know how to interact with CSV rows assigning a variable for each row of data.

Share this post

Link to post
Share on other sites
fopen() with fread() should get you headed in the right direction.

Share this post

Link to post
Share on other sites
Oka think i got it, renamed some variables to make it read better

Please tell me what you think and if the code is good or could be better.

(removed, seeing if it will let me post, getting an error)

Well, I think I have a solution but it will not let me post code for some reason.....

Share this post

Link to post
Share on other sites


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.