Answer the question
In order to leave comments, you need to log in
How to get specific value from SimpleXMLElement object?
Good afternoon or evening, I have bank-acquiring on servlets here (yes-yes), this is the answer to my request . I need to get OrderID, SessionID from the response to generate a link to redirect the buyer. But my variables are empty.
I will be glad for any hints. Thanks in advance for your responses!
Response format:
Response to sent xml:
Here is the code for sending the request:
<?
$xml= 'Тут Xml';
$url = 'https://epaypost.fortebank.com/Exec';
$curl = curl_init($url);
$url = 'https://epaypost.fortebank.com/Exec';
$curl = curl_init($url);
curl_setopt ($curl, CURLOPT_HTTPHEADER, array("Content-Type: text/xml"));
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_POSTFIELDS, $xml);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
$result = curl_exec($curl);
if(curl_errno($curl)){
throw new Exception(curl_error($curl));
}
curl_close($curl);
//Print out the response output.
$res = simplexml_load_string($result);
//print_r($res);
//Тут мои попытки получить нужное,но переменные пустуют.(Первый скрин)
$orderid = (string)$res->OrderID;
$sessionid = (string)$res->SessionID;
header('Location: https://epay.fortebank.com/?' . http_build_query(array(
'OrderID' => $orderid,
'SessionID' => $sessionid
)));
?>
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question