09-15-2009, 05:31 PM
|
#1 (permalink)
|
|
The Contributor
Join Date: Jul 2009
Posts: 80
Thanks: 13
|
serialize XML Category
I have been working on this for around 2 days now, Having the same issue it seems that I can serialize the categories.
They return the following
Code:
Array ( [0] => SimpleXMLElement Object ( ) ) a:1:{i:0;O:16:"SimpleXMLElement":0:{}}
Does any one now how to fix this issue?
PHP Code:
<?php
$feed = file_get_contents("http://www.techau.tv/blog/?feed=rss2");
$xml = new SimpleXmlElement($feed);
foreach ($xml->channel->item as $entry)
{
echo $entry->title.'<br/>';
echo $entry->description.'<br/><br/>';
$keywordsArray = array();
foreach ($entry->category as $a => $b)
{
$keywordsArray[] = $b;
}
print_r($keywordsArray);
//serialize keyword array ready for posting in link
$keywords = str_replace(
array('O:16:"SimpleXMLElement":0:{}', 'O:16:"SimpleXMLElement":'),
array('s:0:"";', 'O:8:"stdClass":'),
serialize($keywordsArray)
);
print $keywords;
print "<br/><br/>";
}
?>
|
|
|
|