far2slow Posted November 5, 2012 Share Posted November 5, 2012 (edited) we have a small fourm will only ever be 100 members each member has a xbox gamer id in there profile what i want to do is call each gamer id and pass it to xbox live and fetch there online status but as this will take some time to do is it best i run a script that will do the scraping in the background let it run every hour and send the the result into the database so it can be called or am i going about this all the wrong way ? Edited November 5, 2012 by far2slow Quote Link to comment Share on other sites More sharing options...
Psycho Posted November 5, 2012 Share Posted November 5, 2012 I would check how long it takes to get the information from Xbox Live. Based on what I know you can only check the online status of your friends. If these people are all your friends on Xbox Line then it would only take one scrape to get all of their online statuses. If you are going to do multiple scrapes to get the data then my answer below might change. Based upon my understanding this is the process I would follow. When page loads where you want to display online status: 1. Script should first check if a cache file exists (e.g. xbox_online.txt). 2a. If the file does not exist then create it. 2b. If the file exists, check the time that the file was last updated. 3. If 2a was true OR if the last updated time was > the specified value (e.g. 60 minutes) then run a screen scrape and put the results into the cache file 4. Use the data in the cache file to display the online status of the users Using the above process you will only get a new online status if a user visits the page and the cache data is > 60 minutes (or whatever value you set). I would not think that scraping the page would take so long that it would be an issue. I suggest the cache file with the assumption that the data is only going to be used for displaying the online status. In fact, I would create the cache file already formatted as HTML code. So, you would only need to include() it int he output of the page. However, if you have other purposes for this data, then you should put it in the database. Quote Link to comment 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.