I have a script that checks the status of a persons Skype account (online, offline etc), for some reason it has caused resource issues (memory), or atleast it seems to be at fault.
I have removed some information from the script (just html), can anyone see an issue here? Does file_get_contents have issues with memory? It is only fetching a small XML file, the XML file definitely exists.
It certainly seems to be the cause but if I was absolutely certain I guess I would also know how to fix it lol.
The website is just a simple HTML/CSS site with some elements of PHP but no database connections. This script is the only actual processing that PHP does on the pages (every page).
I cannot be 100% sure that Skype is responding well but even if it is slow, would it cause memory issues on the server and not just a slow page load?
Unless this is critical to the application, I’d move this to an AJAX call and let the client deal with it. If it is critical, create a cron job to cycle through the users which you intend to target and save the response locally. Additionally, be sure to add a timeout factor to all these requests and handle the timeout appropriately.
It is not critical and the fall-back is designed to always allow the user to initiate a chat (the script is only to allow the button to initiate a call request if the Skype is online rather than a chat/message).
Using AJAX is a good idea. I was thinking of running the script once when the use enters the site and caching that value and once the user has been on the site for 5mins it re-checks. Maybe I should combine the two.