I searched the web and the stackoverflow archive and haven't found anything that really helped me solve this problem.
I have the following XML file
<?xml version="1.0"?>
<Results>
<Result>
<Step>001</Step>
<State>1</State>
<Complete>true</Complete>
</Result>
<Result>
<Step>002</Step>
<State>1</State>
<Complete>true</Complete>
</Result>
<Result>
<Step>003</Step>
<State>1</State>
<Complete>false</Complete>
</Result>
</Results>
And I want to get the value of Complete with the help of Step. So basically, the Client calls getSuccess(param) where param is an entered Step e.g. 002 . I then want to get the value of this specific Array (or Result tree). My Code looks like this right now
public function getSuccess($step){
$doc = new DOMDocument('1.0');
$doc->formatOutput = true;
$doc->Load("./API/response.xml");
// Borat: >>Great Success!<<
$Borat = $doc->getElementsByTagName('Result');
foreach ($Borat as $Result) {
###########
#CODE HERE#
###########
}
}
I am now looking for the exact code to echo the result.
Thanks in advance. And if there exists a topic that solved my problem, please let me know and I will close this one.