melsom Posted January 5, 2011 Share Posted January 5, 2011 Hello, I'm trying to extract information about a ticket through osTicket SOAP API, but I can't seem to figure out how! This is the return from the script (var_dump): array(1) { [0]=> object(stdClass)#2 (2) { ["question"]=> object(stdClass)#3 (4) { ["id"]=> int(25) ["created"]=> string(25) "2011-01-05T01:19:43+01:00" ["name"]=> string(4) "test" ["message"]=> string(4) "qasd" } ["answers"]=> array(1) { [0]=> object(stdClass)#4 (4) { ["id"]=> int(25) ["created"]=> string(25) "2011-01-05T01:25:06+01:00" ["name"]=> string(17) "Andreas Haakonsen" ["message"]=> string(3) "ler" } } } } A ticket can have several answers. I just can't seem to figure out how to extract/use this data and present it on my webpage. Too many arrays for me to understand I guess Is there anyone who can help me with some small code to help me figure this one out? Thanks! Quote Link to comment Share on other sites More sharing options...
AbraCadaver Posted January 5, 2011 Share Posted January 5, 2011 Something like this should work: $question = $array[0]->question; echo $question->name; echo $question->message; $answers = $array[0]->answers; foreach($answers as $answer) { echo $answer->name; echo $answer->message; } Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.