0
<?php 
$notificationCode = preg_replace('/[^[:alnum:]-]/','',$_POST["notificationCode"]); 

$data['token'] = 'MYTOKEN';
$data['email'] = 'my@mail.com';

$data = http_build_query($data);

$url = 'https://ws.sandbox.pagseguro.uol.com.br/v3/transactions/notifications/'.$notificationCode.'?'.$data;

$curl = curl_init($url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); 
curl_setopt($curl, CURLOPT_URL, $url);
$xml = curl_exec($curl);
curl_close($curl);

$xml = simplexml_load_string($xml); 

$reference = $xml->$reference;
$status = $xml->$status;
$numeral = $xml->$description;

if ($status == 3) {
         include_once 'conexao.php';
         $sql = "UPDATE table SET number = number + '".$numeral."' WHERE reference = '".$reference."'";
         mysqli_query($conexao, $sql);
}


?>

I have this code which should receive a notification code from pagseguro.com.br and insert stuff on DB, but it doest not UPDATE the MySQL as it should.

The Notification sends an XML with some information, like , , ...

I don't know what's wrong, it looks alright to me, please help, thanks

0 Answers0