added application/json header and some debug stuff in index.php by clainatomi