You are here: Re: [PHP] Problem reading SimpleXML array « PHP « IT news, forums, messages
Re: [PHP] Problem reading SimpleXML array

Posted by "Richard Lynch" on 10/24/05 19:06

On Mon, October 24, 2005 3:50 am, George Pitcher wrote:
> Hi,
>
> I'm having a problem reading an xml feed. This is my object:
>
> SimpleXMLElement Object (
> [Header] => SimpleXMLElement Object (
> [ID] => FX12GB
> [Test] => false
> [Name] => Foreign Exchange United Kingdom Pound Noon Rates
> [Prepared] => 2005-10-24
> [Sender] => SimpleXMLElement Object (
> [Name] => Federal Reserve Bank of New York
> [Contact] => SimpleXMLElement Object (
> [Name] => George Matthes
> [Email] => george.matthes@ny.frb.org ) )
> [ReportingBegin] => 1994-01-06 )
> [DataSet] => SimpleXMLElement Object (
> [Series] => SimpleXMLElement Object (
> [Key] => SimpleXMLElement Object (
> [FREQ] => D
> [CURR] => GBP
> [FX_TIME] => 12
> [FX_TYPE] => S )
> [Obs] => SimpleXMLElement Object (
> [TIME_PERIOD] => 2005-10-21
> [OBS_VALUE] => 1.7692 ) ) ) )
>
> I'm trying to get those last two lines: TIME_PERIOD and OBS_VALUE.
>
> I can get the ID (third line) using $s->Header->ID (where $s is my
> object).
> $s->DataSet->Series->Obs->TIME_PERIOD; // 'Trying to get property of
> non-object'


echo "<PRE>";
var_dump($s);
echo "<hr />\n";
var_dump($s->DataSet);
echo "<hr />\n";
var_dump($s->DataSet->Series);
echo "<hr />\n";
..
..
..

--
Like Music?
http://l-i-e.com/artists.htm

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация