Created
May 30, 2013 02:51
-
-
Save rafaelgou/5675466 to your computer and use it in GitHub Desktop.
Proxy para notificações do PagSeguro
Permite configurar apenas uma conta do PagSeguro que repassa notificações para várias lojas
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$logfile = '/var/log/pagseguro/notifications.log'; | |
$handler = fopen($logfile, 'a'); | |
$message = $_SERVER['REMOTE_ADDR'] . ' - ' . date('Y-m-d H:i:s') . ' - ' . | |
serialize($_REQUEST) . PHP_EOL; | |
fwrite($handler, $message); | |
fclose($handler); | |
$urls = array( | |
'http://loja1.dominio.com.br/customer/pagseguro_notification.php', | |
'http://loja2.dominio.com.br/customer/pagseguro_notification.php', | |
// quantas lojas necessitar | |
); | |
foreach ($urls as $url) | |
{ | |
$ch = curl_init(); | |
curl_setopt($ch, CURLOPT_URL, $url); | |
curl_setopt($ch, CURLOPT_HEADER, 0); | |
curl_setopt($ch, CURLOPT_POST, 1); | |
curl_setopt($ch, CURLOPT_POSTFIELDS, $_POST); | |
curl_exec($ch); | |
curl_close($ch); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment