Trying to access the objects in this array. I followed the
No matter what I try I can't get what I need out of the array.
The only thing that does work is
echo $response->TotalResults;
That gives me the value of 18. Great but when I try
echo $response->Call[0]->ToNumber->_;
or
echo $response->Call->CallRecord->Result;
It returns blank
I have tried a foreach loop from the other posting:
foreach($responses->TotalResults as $value){
foreach($value->Call as $obj){
echo $obj->FromNumber;
}
echo $value->name;
}
Returns nothing. I really didn't find anything that would help on the php site that would help guide me in what to do to retrieve data from this kind of array. Below is the sample array of data.
object(stdClass)#8 (2) {
["TotalResults"]=> int(18)
["Call"]=> array(18) {
[0]=>
object(stdClass)#9 (12) {
["FromNumber"]=>
string(11) "17575551211"
["ToNumber"]=>
object(stdClass)#10 (1) {
["_"]=>
string(11) "17575554039"
}
["State"]=>
string(8) "FINISHED"
["BatchId"]=>
int(33236)
["BroadcastId"]=>
int(1069425001)
["ContactId"]=>
float(836743)
["Inbound"]=>
bool(false)
["Created"]=>
string(20) "2013-08-09T15:24:11Z"
["Modified"]=>
string(20) "2013-08-11T13:16:54Z"
["FinalResult"]=>
string(2) "LA"
["id"]=>
float(1001389)
["CallRecord"]=>
array(2) {
[0]=>
object(stdClass)#11 (7) {
["Result"]=>
string(2) "LA"
["FinishTime"]=>
string(20) "2013-08-11T13:16:51Z"
["BilledAmount"]=>
float(1.6667)
["QuestionResponse"]=>
object(stdClass)#12 (2) {
["Question"]=>
string(4) "Q1R1"
["Response"]=>
string(7) "Confirm"
}
["id"]=>
float(572965)
["AnswerTime"]=>
string(20) "2013-08-11T13:16:22Z"
["Duration"]=>
int(29)
}
[1]=>
object(stdClass)#13 (6) {
["Result"]=>
string(6) "NO_ANS"
["FinishTime"]=>
string(20) "2013-08-11T13:01:05Z"
["BilledAmount"]=>
float(0)
["id"]=>
float(57296503001)
["OriginateTime"]=>
string(20) "2013-08-11T13:00:02Z"
["Duration"]=>
int(0)
}
}
}
[1]=>
object(stdClass)#14 (12) {
["FromNumber"]=>
string(11) "17575557998"
["ToNumber"]=>
object(stdClass)#15 (1) {
["_"]=>
string(11) "17575557255"
}
["State"]=>
string(8) "FINISHED"
["BatchId"]=>
int(332369)
["BroadcastId"]=>
int(1069425)
["ContactId"]=>
float(83674367)
["Inbound"]=>
bool(false)
["Created"]=>
string(20) "2013-08-09T15:24:11Z"
["Modified"]=>
string(20) "2013-08-11T13:03:17Z"
["FinalResult"]=>
string(2) "LA"
["id"]=>
float(100138916)
["CallRecord"]=>
object(stdClass)#16 (6) {
["Result"]=>
string(2) "LA"
["FinishTime"]=>
string(20) "2013-08-11T13:03:13Z"
["BilledAmount"]=>
float(5.0001)
["id"]=>
float(57296546)
["AnswerTime"]=>
string(20) "2013-08-11T13:00:35Z"
["Duration"]=>
int(158)
}
}
[2]=>
object(stdClass)#17 (12) {
["FromNumber"]=>
string(11) "17575557998"
["ToNumber"]=>
object(stdClass)#18 (1) {
["_"]=>
string(11) "17575552158"
}
["State"]=>
string(8) "FINISHED"
["BatchId"]=>
int(332369)
["BroadcastId"]=>
int(106942)
["ContactId"]=>
float(83674)
["Inbound"]=>
bool(false)
["Created"]=>
string(20) "2013-08-09T15:24:11Z"
["Modified"]=>
string(20) "2013-08-11T13:03:15Z"
["FinalResult"]=>
string(2) "LA"
["id"]=>
float(100138)
}
}
}
Any help on how to access the array would be great. Regards
echo $response->Call[0]->ToNumber->{'_'};
andecho $response->Call->CallRecord[0]->Result;