brady123 Posted October 9, 2011 Share Posted October 9, 2011 I'm trying to use PHP to read data from EDGAR, the SEC's website for company filings. Filings are in XBRL, a standard for XML. I'm having trouble pulling data using PHP. Here is a link to the data: http://www.sec.gov/Archives/edgar/da...g-20101231.xml Using PHP, I'm trying to get the data from, for example, the following tag: <us-gaap:Assets contextRef="eol_PE633170--1010-K0013_STD_0_20091231_0" unitRef="iso4217_USD" decimals="-6">40497000000</us-gaap:Assets> I've been unsuccessful thus far in getting this data - do you have any suggestions on how to do that? Thank you! Quote Link to comment https://forums.phpfreaks.com/topic/248771-reading-xml-data-from-edgar-with-php/ Share on other sites More sharing options...
brady123 Posted October 10, 2011 Author Share Posted October 10, 2011 Any suggestions? Quote Link to comment https://forums.phpfreaks.com/topic/248771-reading-xml-data-from-edgar-with-php/#findComment-1277769 Share on other sites More sharing options...
Muddy_Funster Posted October 10, 2011 Share Posted October 10, 2011 could you cover what you have actaly tried, and what the outcomes were so we dont go over old ground? Quote Link to comment https://forums.phpfreaks.com/topic/248771-reading-xml-data-from-edgar-with-php/#findComment-1277771 Share on other sites More sharing options...
silkfire Posted October 10, 2011 Share Posted October 10, 2011 Your link is broken =/ Quote Link to comment https://forums.phpfreaks.com/topic/248771-reading-xml-data-from-edgar-with-php/#findComment-1277775 Share on other sites More sharing options...
brady123 Posted October 10, 2011 Author Share Posted October 10, 2011 Fixed link: http://1.usa.gov/nP4odp Quote Link to comment https://forums.phpfreaks.com/topic/248771-reading-xml-data-from-edgar-with-php/#findComment-1277797 Share on other sites More sharing options...
silkfire Posted October 10, 2011 Share Posted October 10, 2011 I think you should try harder. Also your request is very unclear about what it is you want. Anyhow, to extract the Asset node (there are two), you do like this, the number in the bracket denotes which of them you want (in order of appearance in the file, starting from zero): $xml = simplexml_load_file('goog-20101231.xml'); $namespaces = $xml->getNamespaces(true); echo $xml->children($namespaces['us-gaap'])->Assets[0]; Quote Link to comment https://forums.phpfreaks.com/topic/248771-reading-xml-data-from-edgar-with-php/#findComment-1277836 Share on other sites More sharing options...
brady123 Posted October 10, 2011 Author Share Posted October 10, 2011 You're right - I should have been more explicit with what I was asking and given the code I had already tried. I guess I was just frustrated I couldn't get it to work I just posted quickly Anyways, thank you SO much for your help! The namespace part was where I was lacking. Thanks again. Cheers! Quote Link to comment https://forums.phpfreaks.com/topic/248771-reading-xml-data-from-edgar-with-php/#findComment-1277853 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.