update_channel

(ReachRSS >= 0.91)
update_channel -- Reloads / refreshes the specified channel

Description

boolean update_channel ( string channel_url [ , boolean force_reload ] )

This function checks if the channel needs refreshing (based on the channel's ttl property and your own min_cache_time() preferences) and if so, refreshes it from the RSS provider. If the cache time has not yet expired update_channel() will return true without modifying anything.

If force_reload is set to true, the channel will be reloaded from the server, regardless if the cache time has expired or not.

update_channel() returns true on success, false if there was an HTTP error while retrieving the new data.

Note that update_channel() does NOT automatically call save_data() after an update, make sure you do so manually after you're finished calling all your updated. If you want to automate channel updates / data saving use the update_all_channels() function instead, or make a call to startup() which handles load_data() as well as update_all_channels() and save_data().

Example 1. update_channel() example

$ReachRSS = new ReachRSS();
$ReachRSS->load_data();
$ReachRSS->add_channel("http://www.comicalert.com/public/popular24.xml");
// You do not actually need to call update_channel() after add_channel(), 
// but this is an example, so...
$ReachRSS->update_channel("http://www.comicalert.com/public/popular24.xml");
// Remember to save after calling update_channel()!
$ReachRSS->save_data();

This example will subscribe ReachRSS to the "most popular comics" feed at Comic Alert! and then immediatly update it.

See also update_all_channels(), save_data(), startup(), load_data(), channel_exists(), channels()

Back to Function List

 

Home | Features | Samples | Demo | Download | Register | Help / Support