(PECL gupnp >= 0.1.0)
gupnp_context_timeout_add — Sets a function to be called at regular intervals
Sets a function to be called at regular intervals.
A context identifier, returned by gupnp_context_new().
A timeout in miliseconds.
The callback function calling every timeout period of time. Typically, callback function takes on arg parameter.
User data for callback.
Возвращает TRUE в случае успешного завершения или FALSE в случае возникновения ошибки.
Пример #1 Create new UPnP context and set callback
<?php
$user_data = "user data";
function timeout_cb($arg)
{
printf("Call timeout_cb, user data: '%s'", $arg);
return true;
}
/* Create the UPnP context */
$context = gupnp_context_new();
if (!$context) {
die("Error creating the GUPnP context\n");
}
/* Create root device */
$dev = gupnp_root_device_new($context, "/devicedesc.xml");
/* Set callback for timeout */
gupnp_context_timeout_add($context, 5000, "timeout_cb", $user_data);
/* Run the main loop */
gupnp_root_device_start($dev);
?>
Issues E_WARNING with not valid callback function.