Question

I'm reading a rss feed from

$homepage = file_get_contents('http://feeds.cbsnews.com/CBSNewsWorld');

 $movies = new SimpleXMLElement($homepage);

and I found data like this

    [item] => Array
            (
                [0] => SimpleXMLElement Object
                    (
                        [title] => Japan grants stricken nuke co. $11B for cleanup

                        [description] => Cash-strapped 
                        ....and more
                    )

my problem is when I see the page source of this URL I found a addition field

 <feedburner:origLink>http://www.cbsnews.com/8301-202_162-57318337/girl-3-eats-leftovers-for-2-days-after-mom-dies/</feedburner:origLink>

but I cant see this field in this array, and I want to store this field in my database. please suggest...

Was it helpful?

Solution

I found the same problem. What I did is modify all RSS file and it works great (I access to thousands of feeds every day). In your case:

$homepage = file_get_contents('http://feeds.cbsnews.com/CBSNewsWorld');

//HACK: SimpleXmlParser don't works well with ':' in tags (like <feedburner:info>)
$homepage = preg_replace("/(<\/?)(\w+):([^>]*>)/", "$1$2$3", $homepage);

$movies = new SimpleXMLElement($homepage);

Now feedburner:origLink is feedburnerorigLink

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top