@zaadjis i tried your code, it works but i had a warning, it does post those json data but it doesn't have a response, the warning is this
file_get_contents(http://yoursite.com/test.json): failed to open stream: HTTP request failed! HTTP/1.1 500 Internal Server Error