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
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.....
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.