0

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.

Jason Aller
  • 3,541
  • 28
  • 38
  • 38
  • possible duplicate of [How to generate json using php?](http://stackoverflow.com/questions/1435072/how-to-generate-json-using-php) – B001ᛦ Aug 14 '15 at 13:12
  • what does `print_r($_POST);` display? – Yerko Palma Aug 18 '15 at 12:21
  • and no its not a duplicate answer thats other thing completly different than generate a json, here from a webserver they are posting me a json file, and I want to know how to receive it for could treat the data – Alberto Ce Ce Aug 24 '15 at 11:22

2 Answers2

0

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/

MaximeK
  • 2,039
  • 1
  • 10
  • 16
0

the data is being posting to me by http post json from a website where I just have to write url where I want the data to be send, the url has to be like this link where document is the file in php where I want to show the data that is being posted and then insert into the database but the case is I cant even show the data Im receving, always receive null or empty array or array{0}() I have tried aswell just to receive with file_get_content(php://input) and then with file_put_contents write and create a file with the suposed data Im receving but the file contains nothing, Thank you all for the answers.