I have the following php:
$getlists = new CS_REST_Campaigns($_POST['campaign_id'], $auth);
$getlistsresult = $wrap->get_lists_and_segments();
if($getlistsresult->was_successful()) {
echo '<pre>';
var_dump($getlistsresult->response);
echo '</pre>';
}
The above outputs:
object(stdClass)#310 (2) {
["Lists"]=>
array(1) {
[0]=>
object(stdClass)#309 (2) {
["ListID"]=>
string(32) "xxxxxxxxxxxxxxxxxxxxxx"
["Name"]=>
string(6) "List 1"
}
}
["Segments"]=>
array(0) {
}
}
How would i target / extract the ListID?
I have tried the following which doesnt return anything:
foreach($getlistsresult->response->Results as $entry) {
echo $entry->ListID;
}
Looks like there's a mistake in your foreach:
foreach($getlistsresult->response->Lists as $entry) {
echo $entry->ListID;
}