1
I’m getting tickets through the Zendesk api, but I don’t know how to foreach the result giving an echo in the indexes.
$subdomain = "meusubdominio";
$username = "[email protected]";
$token = "xxx";
$client = new ZendeskAPI($subdomain);
$client->setAuth('basic', ['username' => $username, 'token' => $token]);
$getTickets = $client->tickets()->findAll();
How do I give a foreach on $getTickets, to echo the contents ? For example, I want to echo all indexes ["url"].
I know the example below is wrong, but it is to exemplify what I would like to do with the results.
I imagine I have to do some treatment at $getTickets before I get that result. I just don’t know what should be done.
Ex:
foreach($getTickets as $Tct):
echo "<p>{$Tct['url']}</p>";
endforeach;
If I var_dump her, I have the results as:
object(stdClass)#53 (4) { ["tickets"]=> array(11) { [0]=> object(stdClass)#45 (31) { ["url"]=> string(50) "https://......
So it seems that the
foreach
must be in$getTickets->tickets
– Woss
Thank you very much, that’s right. Solved!
– Rafael Neves