Reading API response in PHP -


i making request mixpanel api

$data = $mp->request(array('segmentation'), array(     'event' => 'loaded page',     'name' => 'loaded page',     'from_date' => '2015-07-01',     'to_date' => '2015-07-01',     'type' => 'unique',        'expire' => '1439089200'     //'unit' => 'day',     //'interval' => '7',     //'format' => 'json' )); //echo $data; var_dump($data); 

here response getting.

object(stdclass)#2 (2) { ["legend_size"]=> int(1) ["data"]=> object(stdclass)#3 (2)  { ["series"]=> array(1) { [0]=> string(10) "2015-07-01" } ["values"]=> object(stdclass)#4 (1)  { ["loaded page"]=> object(stdclass)#5 (1) { ["2015-07-01"]=> int(267691) } } } } 

can please me how can read response in variables. want count of loaded page event '2015-07-01' response.

say want count of loaded page event '2015-07-01' response.

$data->values->{"loaded page"}->{"2015-07-01"} 

please note, nasty format. check if request() takes parameters adjust format.

nonetheless, i'd encourage read objects properties in php , answer accessing class properties spaces.


Comments

Popular posts from this blog

yii2 - Yii 2 Running a Cron in the basic template -

asp.net - 'System.Web.HttpContext' does not contain a definition for 'GetOwinContext' Mystery -

wso2esb - How to concatenate JSON array values in WSO2 ESB? -