The secure paypal sandbox is not sending the notifications to my page, is set to url on the Integration Profiles tab - > seller, and also the notificationURL in the transaction request.
Success image on localhost
Thecodeonmypagerereceivesthenotificationsisthis:
<?php
header("access-control-allow-origin: https://sandbox.pagseguro.uol.com.br");
$notificationCode = $_POST["notificationCode"];
$data['token'] ='TOKEN';
$data['email'] = '[email protected]';
$data = http_build_query($data);
$url = 'https://ws.sandbox.pagseguro.uol.com.br/v3/transactions/notifications/'.$notificationCode. '?' .$data;
$curl = curl_init();
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_URL, $url);
$xml = curl_exec($curl);
curl_close($curl);
// $my_file = 'file.xml';
// $handle = fopen($my_file, 'w') or die('Cannot open file: '.$my_file);
// fwrite($handle, $xml);
$xml = simplexml_load_string($xml);
$status = $xml->status;
if($status){
$my_file = 'file.xml';
$handle = fopen($my_file, 'w') or die('Cannot open file: '.$my_file);
fwrite($handle, $status);
}
?>