Possible Duplicate:
Able to see a variable in print_r()'s output, but not sure how to access it in code
SimpleXMLElement Object
(
[Header] => SimpleXMLElement Object
(
)
[Body] => SimpleXMLElement Object
(
[CreateUserResponse] => SimpleXMLElement Object
(
[username] => anup_165
[password] => xnrrtgohgv
[result] => SimpleXMLElement Object
(
[succeeded] => true
[errorCode] => 0
[errorText] => SimpleXMLElement Object
(
)
)
)
)
)
i want to fetch username , password and succeeded from the above array
Do you mean:
$username = (string) $xml->Body["CreateUserResponse"]->username;
$password = (string) $xml->Body["CreateUserResponse"]->password;
Well i am going out on a limb here, but it might be something like:
$object['body']['CreateUserResponse']['username']
and
$object['body']['CreateUserResponse']['password']
//For Parsing the xml
$xmltoaparse=simplexml_load_string($xmlresponse);
foreach($xmltoaparse->children() as $iasorecord)
{
foreach($iasorecord as $iasouserrecord) //for each for machhnia attributes
{
foreach($iasouserrecord as $iasousersrecord) //for each for machhnia attributes
{
echo $iasousersrecord->getName();
echo $iasousersrecord;
}
}
}