简体   繁体   中英

How to show data from an http post json with php (the data is being posted to my server to a document)?

I've been looking during a week on the internet all kind of answers to the way of receive the data from and http post, but none of them help me, I'm receiving data from a server which is posting by http post to mine the connection is working and its seems the is sending OK the HTTP POST, but I can't find the way of showing the information, the JSON structure of what is posting is something like this :
{"decodes":[{"id" : 64,"rmv" : "xxxxx","frameID" : xxxxx,"spaced" : "xxxxx", "SF":"xxxxxx"}] }

I've tried to read in all ways the most simple with:

file_get_contents(php://input);
    
echo '<pre>';
print_r($_POST);


$data = json_decode(file_get_contents('php://input'), true);

print_r($_POST);
var_dump($_POST);

I only received or empty Array or NULL , I'm very frustrated I don't know what I'm I missing, there is a guy who has this website where you can try to make your http post there, and when I point there is working perfectly and he received with no problems.

IF you receive the data, clearly file_get_contents will not help you.

Maybe you can have a look at POSTMAN, it's a Chrome extension that allow you to post some data to an url.

url is https://www.getpostman.com/

数据通过 http post json 从一个网站发布给我,我只需要在我想要发送数据的地方写 url,url 必须像这个链接,其中 document 是我想显示的 php 中的文件正在发布的数据然后插入到数据库中,但情况是我什至无法显示我正在接收的数据,总是接收空或空数组或数组{0}() 我也尝试过使用 file_get_content(php: //input) 然后用 file_put_contents 写入并创建一个包含我正在接收的 suposed 数据的文件,但该文件不包含任何内容,谢谢大家的回答。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM