2016-01-25 11:02
浏览 107


Folks I think I may miss a dead simple thing but I just have no idea where to look for it.

So I'm trying to implement API to accept bitcoin payments on a website built on PHP. Now the Docs say that all notification events will use JSON objects pushed to my server through POST requests. So I decided to make a test BTC payment and log all requests on a specified URL to my DB. And here what I gen on dumping getallheaders()

string(16) "application/json"
string(12) ""
string(10) "text/plain"
string(10) "Basic Og=="
string(5) "close"
string(17) ""
string(3) "462" }

But dumping $_POST gives me an empty array. Dumping $_SERVER and $_GET gives nothing useful either. So my question is how can I find the JSON string declared in Content-Type?

Any suggestion would be helpful! Thanks!

  • 写回答
  • 好问题 提建议
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • doubu4826 2016-01-25 11:13

    Because the Content-Type is application/json (not application/x-www-form-urlencoded) $inputJSON = file_get_contents('php://input');

    EDIT: excellent explanation at PHP "php://input" vs $_POST

    解决 无用
    打赏 举报

相关推荐 更多相似问题