PHP API Development Logging and Debugging

If you are ever working with API integrations, either in or out bound, then it might be useful to set up a simple dumb logging system to assist you with developing and debugging things.

Here is a really simple snippet to help you along with that.

It literally takes exactly what it has received and logs it with no messing about. Brilliant!

<?php
$log['raw_input']=file_get_contents('php://input');
$log['_POST']=$_POST;
$log['_GET']=$_GET;

file_put_contents('inboundXML.log', var_export($log, true));

Tags: phploggingxmlsnippetlogapiinput