Search the Community
Showing results for tags 'xml php'.
-
I am having trouble getting the element values i want from the following xml <entry> <category label="form type" scheme="http://www.sec.gov/" term="8-K" /> <content type="text/xml"> <accession-nunber>0001269026-15-000064</accession-nunber> <act>34</act> <file-number>001-33624</file-number> <file-number-href>http://www.sec.gov/cgi-bin/browse-edgar?action=getcompany&filenum=001-33624&owner=exclude&count=40</file-number-href> <filing-date>2015-11-10</filing-date> <filing-href>http://www.sec.gov/Archives/edgar/data/1269026/000126902615000064/0001269026-15-000064-index.htm</filing-href> <filing-type>8-K</filing-type> <film-number>151219153</film-number> <form-name>Current report</form-name> <items-desc>items 8.01 and 9.01</items-desc> <size>36 KB</size> </content> <id>urn:tag:sec.gov,2008:accession-number=0001269026-15-000064</id> <link href="http://www.sec.gov/Archives/edgar/data/1269026/000126902615000064/0001269026-15-000064-index.htm" rel="alternate" type="text/html" /> <summary type="html"> <b>Filed:</b> 2015-11-10 <b>AccNo:</b> 0001269026-15-000064 <b>Size:</b> 36 KB<br>Item 8.01: Other Events<br>Item 9.01: Financial Statements and Exhibits</summary> <title>8-K - Current report</title> <updated>2015-11-10T16:17:52-05:00</updated> </entry> My php code is as follows: $xml = file_get_contents($url, false, $context); $xml = simplexml_load_string($xml); foreach ($xml->entry as $entry){ $Fnum=$entry->{'filing-type'}; $Fdate=$entry->{'filing-date'}; $Flink=$entry->{'filing-href'}; $Form=$entry->{'form-name'}; echo "<li>".$Fnum.$Fdate.$Flink.$Form."</li>"; }It just doesnt load anything. If I make it: foreach ($xml->entry[0] as $entry){ Then it only returns that entry. How can I have it return all of the entries?