You could write a module where you implement hook_cron() to get the authentication ID and then store in the drupal DB (e.g. as variable via variable_set()). After that you can use it inside your templates without any worry. But you have to trigger your cron.php
once a day via a sytem cron-job or the poormanscron module. For PHP xml-parsing take a look at SimpleXML.
EDIT: Module creation:
For this job it would be a simple module. Take a look at the module-dev-guide. First you create a YOURMODULE.info file
. After that you put your code inside a YOURMODULE.module
file. Than implement that hook_cron()
like that:
function YOURMODULE_cron() {
update_news_service_id();
}
function update_news_service_id() {
// add your code here
}
One more comment: If you try to solve it this way you must consider calling update_news_service_id()
from the template (or ..._preprocess()
) if you run into an expired service id-error.