Reputation: 914
Bellow is a $xml resultset. I can access the key "dataset" with $xml['dataset'] but i need to access the key "data" and i can't. Can anyone give me a hand on this?
object(SimpleXMLElement)#17 (2) { ["@attributes"]=> array(1) { ["dataset"]=> string(101) "/DATOSRED/NUMERICO/PRODUCTOS/WRF/WRF_ARW_1KM_2D/20160414/wrf_arw_det1km_history_d06_20160414_0000.nc4" } ["point"]=> object(SimpleXMLElement)#18 (1) { ["data"]=> array(9) { [0]=> string(20) "2016-04-14T15:00:00Z" [1]=> string(5) "41.15" [2]=> string(10) "-8.6166667" [3]=> string(17) "289.3196105957031" [4]=> string(3) "0.0" [5]=> string(17) "3.244610071182251" [6]=> string(17) "3.326730728149414" [7]=> string(18) "224.28402709960938" [8]=> string(13) "24111.9921875" } } }
Upvotes: 0
Views: 125
Reputation: 2905
object(SimpleXMLElement)#17 (2) {
["@attributes"]=> array(1) {
["dataset"]=> string(101) "/DATOSRED/NUMERICO/PRODUCTOS/WRF/WRF_ARW_1KM_2D/20160414/wrf_arw_det1km_history_d06_20160414_0000.nc4"
}
["point"]=> object(SimpleXMLElement)#18 (1) {
["data"]=> array(9) {
[0]=> string(20) "2016-04-14T15:00:00Z"
[1]=> string(5) "41.15"
[2]=> string(10) "-8.6166667"
[3]=> string(17) "289.3196105957031"
[4]=> string(3) "0.0"
[5]=> string(17) "3.244610071182251"
[6]=> string(17) "3.326730728149414"
[7]=> string(18) "224.28402709960938"
[8]=> string(13) "24111.9921875"
}
}
}
If you format the onject, you can see that the array data is nested inside the object point. So you need to do
$xml->point->data
To get the data.
Upvotes: 1