PHP JSON POST data quirk

I encountered a strange PHP post data quirk. I was posting data to a PHP script using a jQuery AJAX call. I was posting all the data as a JSON string. When the PHP script was invoked the $_POST variable was totally empty. I also check $_REQUEST and $_GET and there was no data. I checked the headers and could see the data being passed, but it was not showing up in the standard PHP pre-defined variables. I did some googling and finally came up with this command:

$incoming = json_decode(file_get_contents("php://input"));

That ended up as an object with all of the data passed.


I have recently started using I have been looking at other frameworks for a while, but I finally settled on using knockout. I like the clean code you can use. I never liked having to start your objects/classes by extending a framework base class. There is some KO specific code that you have to include, but it doesn’t take over your code.

I like Durandal as well, but it is in the process of being phased out. The creator of that framework is now on the Angular 2.0 team and will be integrating features of Durandal into Angular. It is unclear when Angular 2.0 will be released and I didn’t want to start using a framework knowing an eventual migration was in the works.

Stay tuned for more Knockout related posts.


I thought I would be more regular with updates when I relaunched the website, but there have been quite a few changes recently. I am no longer working at MicahTek. It was a good experience, but it was time for a change. I am now working as a Programming Consultant at Pick Programmer’s Shop. Most of the projects will be MultiValue database related, but there is also some web development work. The nicest part of the new job is I am now working from home. The commute is much better now.