Jump to content

displaying contents of remote csv file


Malkavbug

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
SOFO_Current_Price
LNUX_Current_Price

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.

Link to comment
https://forums.phpfreaks.com/topic/8985-displaying-contents-of-remote-csv-file/
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.....

Archived

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

×
×
  • Create New...

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.