I have the following code that I think it should work because is REGEX correct (works under Ruby and is checked on regex101.com):
if (preg_match('/<Approved>/', $response)) {
preg_match('/<Approved>(.*)<\/Approved>/', $response, $matches);
$app_code = $matches[0];
}
but I get:
PHP Warning: preg_match(): Unknown modifier '('
and the match that should return APPROVED
is not matched.
The searched data is a XML like:
<Approved>APPROVED</Approved>
or
<Approved>DECLINED</Approved>
EDIT:
More code as per request:
curl_close($ch);
var_dump($response);
if (preg_match('/<Approved>(.*)<\/Approved>/', $response)) {
preg_match('/<Approved>(.*)<\/Approved>/', $response, $matches);
$app_code = $matches[0];
}
if (preg_match('<ReturnCode>(.*)<\/ReturnCode>', $response)) { // This is the problem line
preg_match('/<ReturnCode>(.*)<\/ReturnCode>/', $response, $matches);
$retcode = $matches[0];
}