item_property (ReachRSS >= 0.91) Description string item_property ( string channel_url , string item_id , string property_name ) Returns the value of the requested property_name from the specified item_id in the specified channel_url. If either the channel_url or item_id are invalid, item_property() will return false. If the channel_url and item_id are valid, but the property you're requesting for that item does not exist, item_property() will return NULL. Note that ReachRSS must already be subscribed to channel_url or this function will return false. To obtain a list of subscribed channels use the function channels() or check if the channel already exists using channel_exists(). To obtain a list of valid item_id's for a particular channel, use item_ids() or check that the item id is valid using item_exists(). Here is a complete list of item properties that ReachRSS supports (as of the latest version). Note that this list is CaSe SeNsItIvE (title is valid, Title is not). Also note that simply because ReachRSS supports a property, does not mean that the channel or item you are retrieving a value from supports or lists that value. A return value of NULL means the item is there but does not list the property you are trying to retrieve.
Example 1. item_property() example $ReachRSS = new ReachRSS();
$ReachRSS->Startup();
$ReachRSS->add_channel("http://www.comicalert.com/public/popular24.xml");
$ItemIDs = $ReachRSS->item_ids("http://www.comicalert.com/public/popular24.xml");
foreach ($ItemIDs as $ItemID) {
$ItemTitle = $ReachRSS->item_property(
"http://www.comicalert.com/public/popular24.xml",
$ItemID,
"title"
);
print "$ItemTitle\n";
}
This example will subscribe ReachRSS to the "most popular comics" feed at Comic Alert!, and then retrieve the title of each available item and print it. Be careful not to confuse "" with NULL with FALSE. Here's how to tell the difference (notice the three equal signs (===) instead of usual two): $GUID = $ReachRSS->item_property($ChannelURL,$ItemID,"guid");
if ($GUID===FALSE) {
// either the $ChannelURL or $ItemID we specified was invalid
exit;
}
if ($GUID===NULL) {
// item exists but does not contain a guid element
exit;
}
if ($GUID==="") {
// the $ChannelURL and $ItemID were valid, and the guid element exists,
// but the value is empty
exit;
}
See also channels(), item_ids(), channel_property(), item_exists(), channel_exists()
Home | Features | Samples | Demo | Download | Register | Help / Support
|