I have this link http://lazhalazha.livejournal.com/data/rss with RSS in it, what I need to get is array of guid values, that is links to the post. This is what I have so far…
$xml = simplexml_load_file('http://lazhalazha.livejournal.com/data/rss');
foreach ($xml->channel->item as $item){
print_r($item->guid);
}
Output is series of these objects
SimpleXMLElement Object
(
[@attributes] => Array
(
[isPermaLink] => true
)
[0] => http://lazhalazha.livejournal.com/713.html
)
Solved this by converting this object to string, then it’s passing correct URL instead of object.
$xml = simplexml_load_file('http://lazhalazha.livejournal.com/data/rss');
$linkArray = array();
foreach ($xml->channel->item as $item){
$guid = (string)$item->guid;
array_push($linkArray, $guid);
}
1 Answer