I want to loop through an object array and get id, category and name from it.
Here is my php code. which is getting xml content from a server with a cURL request and then converting it to object array. I don't know how to loop through it and get all the values i want.
<?php
$url = "http://wingz.info/daas3b/search?q=word&top=&user=xxxx&pwd=xxxx";
$ch = curl_init();
curl_setopt ($ch, CURLOPT_URL, $url);
curl_setopt ($ch, CURLOPT_HEADER, 0);
ob_start();
curl_exec ($ch);
curl_close ($ch);
$response = ob_get_clean();
ob_end_clean();
$response_array = @simplexml_load_string($response);
And the Object array is given below.
SimpleXMLElement Object
(
[@attributes] => Array
(
[id] => search
)
[content] => Array
(
[0] => SimpleXMLElement Object
(
[@attributes] => Array
(
[id] => 435
)
[category] => word
[name] => give
)
[1] => SimpleXMLElement Object
(
[@attributes] => Array
(
[id] => 436
)
[category] => word
[name] => verb
)
[2] => SimpleXMLElement Object
(
[@attributes] => Array
(
[id] => 437
)
[category] => word
[name] => noun
)
[3] => SimpleXMLElement Object
(
[@attributes] => Array
(
[id] => 438
)
[category] => word
[name] => person
)
[4] => SimpleXMLElement Object
(
[@attributes] => Array
(
[id] => 439
)
[category] => word
[name] => adjective
)
[5] => SimpleXMLElement Object
(
[@attributes] => Array
(
[id] => 440
)
[category] => word
[name] => adverb
)))