Hi,
I have array of web analytics data.
I want to get data from array and insert into database.
I am not able to traverse array and it look difficult for me.
Please help in to get [aggregates] and [resultsRows] data.
I will store [aggregates] , [resultsRows] country and browser type data.
SimpleXMLElement Object
(
[timePeriod] => SimpleXMLElement Object
(
[period] => date_range
[startDate] => 20100312
[endDate] => 20140331
[startTime] => 1268380800
[endTime] => 1396335599
[label] => 03/12/2010 - 03/31/2014
)
[aggregates] => SimpleXMLElement Object
(
[metric] => Array
(
[0] => SimpleXMLElement Object
(
[@attributes] => Array
(
[name] => visitDuration
[value] => 10
[label] => Avg. Visit Duration
)
)
[1] => SimpleXMLElement Object
(
[@attributes] => Array
(
[name] => bounces
[value] => 4
[label] => Bounces
)
)
[2] => SimpleXMLElement Object
(
[@attributes] => Array
(
[name] => repeatVisitors
[value] => 3
[label] => Repeat Visitors
)
)
[3] => SimpleXMLElement Object
(
[@attributes] => Array
(
[name] => newVisitors
[value] => 1
[label] => New Visitors
)
)
[4] => SimpleXMLElement Object
(
[@attributes] => Array
(
[name] => visits
[value] => 5
[label] => Visits
)
)
[5] => SimpleXMLElement Object
(
[@attributes] => Array
(
[name] => pageViews
[value] => 13
[label] => Page Views
)
)
)
)
[resultsTotal] => 4
[resultsReturned] => 4
[resultsPerPage] => 25
[resultsRows] => SimpleXMLElement Object
(
[row] => Array
(
[0] => SimpleXMLElement Object
(
[dimension] => Array
(
[0] => SimpleXMLElement Object
(
[@attributes] => Array
(
[name] => date
[value] => 20140302
[label] => Date
)
)
[1] => SimpleXMLElement Object
(
[@attributes] => Array
(
[name] => browserType
[value] => Chrome
[label] => Browser Type
)
)
[2] => SimpleXMLElement Object
(
[@attributes] => Array
(
[name] => country
[value] => united states
[label] => Country
)
)
)
[metric] => Array
(
[0] => SimpleXMLElement Object
(
[@attributes] => Array
(
[name] => visitDuration
[value] => 0
[label] => Avg. Visit Duration
)
)
[1] => SimpleXMLElement Object
(
[@attributes] => Array
(
[name] => bounces
[value] => 1
[label] => Bounces
)
)
[2] => SimpleXMLElement Object
(
[@attributes] => Array
(
[name] => repeatVisitors
[value] => 1
[label] => Repeat Visitors
)
)
[3] => SimpleXMLElement Object
(
[@attributes] => Array
(
[name] => newVisitors
[value] => 0
[label] => New Visitors
)
)
[4] => SimpleXMLElement Object
(
[@attributes] => Array
(
[name] => visits
[value] => 1
[label] => Visits
)
)
[5] => SimpleXMLElement Object
(
[@attributes] => Array
(
[name] => pageViews
[value] => 1
[label] => Page Views
)
)
)
)
[1] => SimpleXMLElement Object
(
[dimension] => Array
(
[0] => SimpleXMLElement Object
(
[@attributes] => Array
(
[name] => date
[value] => 20140302
[label] => Date
)
)
[1] => SimpleXMLElement Object
(
[@attributes] => Array
(
[name] => browserType
[value] => Firefox
[label] => Browser Type
)
)
[2] => SimpleXMLElement Object
(
[@attributes] => Array
(
[name] => country
[value] => united states
[label] => Country
)
)
)
[metric] => Array
(
[0] => SimpleXMLElement Object
(
[@attributes] => Array
(
[name] => visitDuration
[value] => 0
[label] => Avg. Visit Duration
)
)
[1] => SimpleXMLElement Object
(
[@attributes] => Array
(
[name] => bounces
[value] => 1
[label] => Bounces
)
)
[2] => SimpleXMLElement Object
(
[@attributes] => Array
(
[name] => repeatVisitors
[value] => 1
[label] => Repeat Visitors
)
)
[3] => SimpleXMLElement Object
(
[@attributes] => Array
(
[name] => newVisitors
[value] => 0
[label] => New Visitors
)
)
[4] => SimpleXMLElement Object
(
[@attributes] => Array
(
[name] => visits
[value] => 1
[label] => Visits
)
)
[5] => SimpleXMLElement Object
(
[@attributes] => Array
(
[name] => pageViews
[value] => 1
[label] => Page Views
)
)
)
)
[2] => SimpleXMLElement Object
(
[dimension] => Array
(
[0] => SimpleXMLElement Object
(
[@attributes] => Array
(
[name] => date
[value] => 20140302
[label] => Date
)
)
[1] => SimpleXMLElement Object
(
[@attributes] => Array
(
[name] => browserType
[value] => Other
[label] => Browser Type
)
)
[2] => SimpleXMLElement Object
(
[@attributes] => Array
(
[name] => country
[value] => united states
[label] => Country
)
)
)
[metric] => Array
(
[0] => SimpleXMLElement Object
(
[@attributes] => Array
(
[name] => visitDuration
[value] => 0
[label] => Avg. Visit Duration
)
)
[1] => SimpleXMLElement Object
(
[@attributes] => Array
(
[name] => bounces
[value] => 1
[label] => Bounces
)
)
[2] => SimpleXMLElement Object
(
[@attributes] => Array
(
[name] => repeatVisitors
[value] => 1
[label] => Repeat Visitors
)
)
[3] => SimpleXMLElement Object
(
[@attributes] => Array
(
[name] => newVisitors
[value] => 0
[label] => New Visitors
)
)
[4] => SimpleXMLElement Object
(
[@attributes] => Array
(
[name] => visits
[value] => 1
[label] => Visits
)
)
[5] => SimpleXMLElement Object
(
[@attributes] => Array
(
[name] => pageViews
[value] => 1
[label] => Page Views
)
)
)
)
[3] => SimpleXMLElement Object
(
[dimension] => Array
(
[0] => SimpleXMLElement Object
(
[@attributes] => Array
(
[name] => date
[value] => 20140303
[label] => Date
)
)
[1] => SimpleXMLElement Object
(
[@attributes] => Array
(
[name] => browserType
[value] => Chrome
[label] => Browser Type
)
)
[2] => SimpleXMLElement Object
(
[@attributes] => Array
(
[name] => country
[value] => united states
[label] => Country
)
)
)
[metric] => Array
(
[0] => SimpleXMLElement Object
(
[@attributes] => Array
(
[name] => visitDuration
[value] => 25
[label] => Avg. Visit Duration
)
)
[1] => SimpleXMLElement Object
(
[@attributes] => Array
(
[name] => bounces
[value] => 1
[label] => Bounces
)
)
[2] => SimpleXMLElement Object
(
[@attributes] => Array
(
[name] => repeatVisitors
[value] => 1
[label] => Repeat Visitors
)
)
[3] => SimpleXMLElement Object
(
[@attributes] => Array
(
[name] => newVisitors
[value] => 1
[label] => New Visitors
)
)
[4] => SimpleXMLElement Object
(
[@attributes] => Array
(
[name] => visits
[value] => 2
[label] => Visits
)
)
[5] => SimpleXMLElement Object
(
[@attributes] => Array
(
[name] => pageViews
[value] => 10
[label] => Page Views
)
)
)
)
)
)
)
-Thanks