KDT Posted August 22, 2009 Share Posted August 22, 2009 I am not a very good php programmer yet.. More of an editor to make stuff look like I want. So I have a question to see if I could get some coding ideas and to see if what I want to do is possible. I have a stock quote feed that I can pull back live stock info via a java applet. It is all fine, but if I could pull a few symbols independently of the applet, I would like to place them info a custom graphic, like for index numbers and such. The way the script works, is by typing in: localhost/stockquote/stockquote.php?symbols=goog,msft,ibm it will return the current info. If you pull it with that url into a browser it will look like this: SYMBOL:GOOG LAST TIME:N/A LAST:465.24 CHANGE:4.83 CHANGEP:1.05% TREND:+ TIME:10:14:05 SYMBOL:MSFT LAST TIME:N/A LAST:24.41 CHANGE:0.74 CHANGEP:3.13% TREND:+ TIME:10:14:05 SYMBOL:IBM LAST TIME:N/A LAST:119.9 CHANGE:0.95 CHANGEP:0.80% TREND:+ TIME:10:14:05 If you look at the source code of that it looks like this: <body>SYMBOL:GOOG LAST TIME:N/A LAST:465.24 CHANGE:4.83 CHANGEP:1.05% TREND:+ TIME:10:14:05 SYMBOL:MSFT LAST TIME:N/A LAST:24.41 CHANGE:0.74 CHANGEP:3.13% TREND:+ TIME:10:14:05 SYMBOL:IBM LAST TIME:N/A LAST:119.9 CHANGE:0.95 CHANGEP:0.80% TREND:+ TIME:10:14:05 </body> Would it be possible make this request via php, parse it into variables and then be able to assign those variables to be displayed on a web page. And if that is possible, would it also be possible to have the code executed ever 10 sec or so to make the updates automatic instead of having to refresh to update. I hope I have posted this in the right forum and thanks for any help in advance... Quote Link to comment https://forums.phpfreaks.com/topic/171427-parsing-question/ Share on other sites More sharing options...
Zane Posted August 22, 2009 Share Posted August 22, 2009 try to explode the data (from the view source) by the \n character. IF that doesn't work then explode by \r or \n\r Quote Link to comment https://forums.phpfreaks.com/topic/171427-parsing-question/#findComment-904067 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.