How to monitor PHP errors on the pages with a POST?

I have a page that works as an API. She only needed to it came to POST data and after that make certain actions.

$data = $_POST['data'];
$signature = $_POST['signature'];

$private_key = "secretkey";
$securcheck = base64_encode( sha1( $private_key . $data . $private_key, 1 ) );

if($securcheck == $signature) {

do....

}


But I can't otsledit the correct implementation code for this I need the POST data! And without them it's just a blank page! How to be in such cases? Tried to use certain functions of mail but it also gets messy when there's a mistake in the course.
July 8th 19 at 15:23
3 answers
July 8th 19 at 15:25
Well send the post data, what's the problem?
Well, or at the time of the change $_POST to $_GET(or $_REQUEST)
July 8th 19 at 15:27
The easiest way is to dip data.
$data = $_POST['data'];
$signature = $_POST['signature'];

$private_key = "secretkey";

$data = 'dataValue';
$signature = 'signatureVaule';

and so on

on php scriptName.php track down the behavior, outdebate.
July 8th 19 at 15:29
Check $private_key . $data . $private_key, 1
Perhaps there is one $private_key must be something else.
You may need delimiters, look carefully the documentation.
There just base64 sha1 zakodirovana raw?
Could just be sha1 (no option 1).

And so, for debugging, use the entry in the file.
The name of the file, e.g. '/tmp/test-'.time().'-'.rand().
There write var_dump($_POST), you can append your intermediate results, for example $securcheck.
Once you see what the format does not fit, but if fits format, see the procedure of counting the checksum. Sometimes there are even typos in the documentation, if nothing helps - contact support.

If hosting a virtual write where is the write access and where you can these files be read.

Find more questions by tags PHP