September 3, 200917 yr Hello all, Does anyone know how I can include a companies share information on a web page. I have found a script that will display info from the Yahoo finance portal, but the date format is the wrong way round ie US. The info isn't quite what the client wants either - they are thinking the feed should come from Bloomberg or Reuters??? If anyone can help put me straight I would be eternally grateful! Andrew
September 3, 200917 yr Try contacting the London Stock Exchange, they must have some dort of feeds you can use? Otherwise try the Yahoo *UK* Finance portal
September 4, 200917 yr Author Yes, looks like I'll have to use a third party service of some kind. The script I found imports data from the Yahoo finance site in the US from a CSV file. I can't find a UK equivalent and cannot change the date to UK format ie day/month/year instead of month/day/year (To be honest this is a part of my job I find a bit frustrating because I can spend hours looking for a solution for something and never need it again )
September 4, 200917 yr (To be honest this is a part of my job I find a bit frustrating because I can spend hours looking for a solution for something and never need it again ) You're not alone - That goes for all of us!
September 7, 200917 yr The only decent services are those that are paid. If you post the code for pulling the data from the Yahoo via CSV we can likely find a solution to the date issue.
September 7, 200917 yr Author Many thanks. This is the code that I am using provided originally by Kevin Kazimir: (I've stripped out the bits that aren't relevant:) <?php $text = file_get_contents("http://download.finance.yahoo.com/d/quotes.csv?s=" . $stockSymbol . "&f=sl1d1t1c1ohgv&e=.csv"); $stockInfo = explode(",", $text); $sssLastTrade = $stockInfo[1]; $sssLastTrade = number_format($sssLastTrade, 2); $sssDate = substr($stockInfo[2], 1); $sssDate = substr($sssDate, 0, -1); $sssTime = substr($stockInfo[3], 1); $sssTime = substr($sssTime, 0, -1); $sssChange = $stockInfo[4]; $sssOpen = $stockInfo[5]; $sssOpen = number_format($sssOpen, 2); $sssTodayMax = $stockInfo[6]; $sssTodayMax = number_format($sssTodayMax, 2); $sssTodayMin = $stockInfo[7]; $sssTodayMin = number_format($sssTodayMin, 2); $sssVolume = $stockInfo[8]; ?> Is it possible to add some code that flips month/day/year to day/month/year? Andrew
September 8, 200917 yr Change: $sssDate = substr($stockInfo[2], 1); $sssDate = substr($sssDate, 0, -1); to: $sssDate = trim($stockInfo[2], '"'); $sssDate = date("d M y", strtotime($sssDate)); Change d M y to the date format you require, using http://php.net/date
September 8, 200917 yr Author LIFE SAVER!!!!!!! Thanks so much for your time - works perfectly. Andrew
Create an account or sign in to comment