think I'm going mad but think i've tried everything possible!
got an object like so;
object(stdClass)#9 (8) {
["Results"]=>
array(3) {
[0]=>
object(stdClass)#10 (5) {
["EmailAddress"]=>
string(22) "38ec95a@emailtests.com"
["Name"]=>
string(13) "Daniel Crabbe"
["Date"]=>
string(19) "2011-07-11 13:00:00"
["State"]=>
string(6) "Active"
["CustomFields"]=>
array(0) {
}
}
[1]=>
object(stdClass)#11 (5) {
["EmailAddress"]=>
string(12) "dan@jynk.net"
["Name"]=>
string(13) "Daniel Crabbe"
["Date"]=>
string(19) "2011-10-11 12:43:00"
["State"]=>
string(6) "Active"
["CustomFields"]=>
array(0) {
}
}
[2]=>
object(stdClass)#12 (5) {
["EmailAddress"]=>
string(23) "nikolaprice@hotmail.com"
["Name"]=>
string(12) "Nicola Price"
["Date"]=>
string(19) "2011-08-25 16:24:00"
["State"]=>
string(6) "Active"
["CustomFields"]=>
array(0) {
}
}
}
["ResultsOrderedBy"]=>
string(5) "email"
["OrderDirection"]=>
string(3) "asc"
["PageNumber"]=>
int(1)
["PageSize"]=>
int(150)
["RecordsOnThisPage"]=>
int(3)
["TotalNumberOfRecords"]=>
int(3)
["NumberOfPages"]=>
int(1)
}
and trying to loop through array(3) and get the email addresses with;
foreach($subscribed_result->results as $sr){
$res++;
echo $res.": ".$sr->EmailAddress." ".$sr['EmailAddress']." ";
}
and several variations but getting nowhere. what am into understanding?
Updates
this works better and can get the object from $sr as an array but still can't get $sr->emailAddress.
print $subscribed_result->response->Results[0]->EmailAddress; // works?
foreach($subscribed_result->response->Results as $sr){
echo $sr->EmailAdress.""; // doesn't work?
echo "<pre>";
print_r($sr);
echo "</pre>";
}
spits out;
stdClass Object
(
[EmailAddress] => 38ec95a@emailtests.com
[Name] => Daniel Crabbe
[Date] => 2011-07-11 13:00:00
[State] => Active
[CustomFields] => Array
(
)
)