PHP help - webservices

Soldato
Joined
1 Feb 2006
Posts
8,188
Hi guys,

I have a script which connects to a web service on the web and fills up some parameters which are then echoed out to some of my pages. Sometimes the service can be very unrealiable and so my webpage will only load half way then it times out while trying to connect to the soap service (it isn't my code).

I was thinking of running the web service call as a cron job and populating some fields with the result of the service call. I can then check on my page to see if the values are not empty then display them. This will save a call to the service and so won't break my page if it times out.

The thing i'm not sure about is how I will assign variables to store the result of the cron job. Say I run the script every night at midnight can I assign the results to some server variables which will still be accessible by every call to my webpage at any time in the next 24 hours until the script is ran again? Basically I just want to minimise the risk of letting a faulty web service connection prevent my pages from fully loading.

Just not sure what way is best to work this.

Thanks
 
Thanks for the info. It will be modified once a day so I got it working there with a db insert instead but the caching sounds better idea. It will only be a few lines of text to pull back each day as it is like a random generated text thingy. Will look into some caching tutorials and report back if i have problems. Thanks again.
 
Thanks again for the help Augmented. I have been doing php for my own wee projects for a few years and am surprised I never came across caching or how to use the output buffering. Both very handy but the looks of things. I created a gallery script a while back which iterates a directory and builds up links to images. This is done on every single call to the page so I guess caching the page would be a much faster option as the gallery contents wont change too often. The help is much appreciated.
 
Back
Top Bottom