-1

I am trying to extract text given in sessionid tag in soap response.

$result looks like this:

<soap:envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:body>
    <loginresponse xmlns="http://ssdsds.com">
        <loginresult>
            <exceptioncode>0</exceptioncode>
            <exceptiondescription>No error</exceptiondescription>
        </loginresult>
    <sessionid>8d7fff17-16fd-40b7-a98e-7fa8ae1cc26f</sessionid>
    </loginresponse>
</soap:body>

now with this regex I do receive 0

$pattern = "#<\s*?$sessionid\b[^>]*>(.*?)</$sessionid\b[^>]*>#s";
preg_match($pattern, $response2, $matches);
$here = $matches[1];

 echo"<br />$here<br />";

any thoughts?

Paul
  • 27
  • 5

1 Answers1

0

Ok I have it done with preg_match("'<sessionid>(.*?)</sessionid>'si", $response, $match); if($match) echo "result=".$match[1]; thanks

Paul
  • 27
  • 5