I'm trying to loop through the xml file here http://www.sec.gov/Archives/edgar/xbrlrss.xml and return the value for each edgar:cikNumber in the file .
The syntax I'm using is below and obviously wrong as it's not returning any data. Can somebody kindly point me to the correct syntax.
The error is in one of the two lines;
Code: Select all
foreach ($rss->channel->item->edgar:xbrlFiling as $filing) {
echo "<p>" . $filing->edgar:cikNumber . "</p>";//C
Code: Select all
<?php // Load and parse the XML document
$rss = simplexml_load_file('http://www.sec.gov/Archives/edgar/xbrlrss.xml');
$title = $rss->channel->title;
?>
<html xml:lang="en" lang="en">
<head>
<title><?php echo $title; ?></title>
</head>
<body>
<?php
// loop to include each item and generate a html table
foreach ($rss->channel->item->edgar:xbrlFiling as $filing) {
echo "<p>" . $filing->edgar:cikNumber . "</p>";
}
?>
</body>
</html>