Check for errors in PHP file executed by external url

4

Good morning,

I'm working with the checkout service of Cielo and I'm having a problem at the time of processing the url return, that is, the file is called when there is an update in the payment, soon I never directly access the file, it is called through url by own Cielo .

The problem is that I am not able to run some sql codes and I also can not debug them.

When I just check the incoming file I use this code:

$data = $_POST;
$filename = microtime(true);
$fp = fopen($filename.'.json', 'w');
fwrite($fp, json_encode($data));
fclose($fp);

This generates a file with all data correctly. But when I try something like this:

require_once('server.php'); //Aqui está a conexão com o banco e funções de query
$query = sql('SELECT * FROM ...');

$filename = microtime(true);
$fp = fopen($filename.'.json', 'w');
fwrite($fp, json_encode($query));
fclose($fp);

No files are written to the server, so I can not see what's happening.

How can I get around this?

    
asked by anonymous 24.06.2016 / 16:36

1 answer

0

I went through the same situation some time ago, and I was able to debug referring to the server log files .

In addition, I used the error_log method of PHP to write custom messages to the logo file in order to facilitate debugging.

    
19.08.2016 / 14:05