Malkavbug Posted May 3, 2006 Share Posted May 3, 2006 :)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 columnWhen 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 containsSOFO_Current_PriceLNUX_Current_PriceThis 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_PriceIf 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. Quote Link to comment https://forums.phpfreaks.com/topic/8985-displaying-contents-of-remote-csv-file/ Share on other sites More sharing options...
ober Posted May 3, 2006 Share Posted May 3, 2006 fopen() with fread() should get you headed in the right direction. Quote Link to comment https://forums.phpfreaks.com/topic/8985-displaying-contents-of-remote-csv-file/#findComment-33033 Share on other sites More sharing options...
Malkavbug Posted May 3, 2006 Author Share Posted May 3, 2006 Thanks, will dig through those :) Quote Link to comment https://forums.phpfreaks.com/topic/8985-displaying-contents-of-remote-csv-file/#findComment-33038 Share on other sites More sharing options...
Malkavbug Posted May 3, 2006 Author Share Posted May 3, 2006 Oka think i got it, renamed some variables to make it read betterPlease 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..... Quote Link to comment https://forums.phpfreaks.com/topic/8985-displaying-contents-of-remote-csv-file/#findComment-33069 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.