How can i print these results?I mean how can access this array?

2009/7/8 paulos nikolo <[email protected]>

> ty for your quick reply robert.Well i have tried it and see what it prints:
>
> Array
> (
>     [Geonames] => Array
>         (
>             [style] => MEDIUM
>             [totalResultsCount] => 1646
>
>             [Geoname] => Array
>                 (
>                     [0] => Array
>                         (
>                             [name] => Barcelona
>                             [lat] => 41.3887868890716
>
>                             [lng] => 2.15898513793945
>                             [geonameId] => 3128760
>                             [countryCode] => ES
>                             [countryName] => Spain
>
>                             [fcl] => P
>                             [fcode] => PPLA
>                         )
>
>                     [1] => Array
>                         (
>                             [name] => Barcelona
>
>                             [lat] => 10.1333333
>                             [lng] => -64.7
>                             [geonameId] => 3648559
>                             [countryCode] => VE
>                             [countryName] => Venezuela
>
>                             [fcl] => P
>                             [fcode] => PPL
>                         )
>
>                     [2] => Array
>                         (.......
>
>
>
> 2009/7/8 Robert P <[email protected]>
>
>
>> Um, have you tried checking the contents of $parsed_xml?
>>
>>    debug($parsed_xml);
>>
>> On Jul 8, 6:33 pm, Paulos23 <[email protected]> wrote:
>> > Hi people,
>> > I am running a problem here.I am using HttpSocket to get some data
>> > from an external site(i am building a geocoding app) but i cant
>> > manipulate the returned xml data.I do somewthing like this
>> >
>> > $results = $HttpSocket->get('http://ws.geonames.org/search?',
>> > 'q=barcelona&maxRows=10');
>> >                 $parsed_xml =& new XML($results);
>> >                 $parsed_xml = Set::reverse($parsed_xml);
>> >
>> > and when i use debug($results); i get the data i want but in their
>> > pure format.The xml looks like this:
>> >
>> > <geonames style="MEDIUM">
>> > <totalResultsCount>6784</totalResultsCount>
>> > -
>> > <geoname>
>> > <name>London</name>
>> > <lat>51.5084152563931</lat>
>> > <lng>-0.125532746315002</lng>
>> > <geonameId>2643743</geonameId>
>> > <countryCode>GB</countryCode>
>> > <countryName>United Kingdom</countryName>
>> > <fcl>P</fcl>
>> > <fcode>PPLC</fcode>
>> > </geoname>
>> > -
>> > <geoname>
>> > <name>London</name>
>> > <lat>42.983389283</lat>
>> > <lng>-81.233042387</lng>
>> > <geonameId>6058560</geonameId>
>> > <countryCode>CA</countryCode>
>> > <countryName>Canada</countryName>
>> > <fcl>P</fcl>
>> > <fcode>PPL</fcode>
>> > </geoname>
>> > .........
>> >
>> > How can i show in my view only the name,countryCode and countryName
>> > attributes?I have read many articles but nothing helped me!
>> >
>> > Any help guys?
>> >
>> > Ty v.much!
>> >>
>>
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to