So I must have spent six (not kidding at all) hours today figuring this out, so I think it’s worth posting up here in case it spares anyone else similar OCDishness. I was working with Google Code today, trying to see what is what, and I came across a service called PostCommitWebHooks, which uses a new technology called Web Hooks for sites to update one another when something mutually-interesting happens. It employs an update mechanism called JSON (XML I hardly knew ye!) with HMAC hashes and whatever else, basically I was way out of my depth.
But this Google support page seemed so straightforward and clear-eyed about the whole thing that I thought it can’t be that bad. Of course the examples are in Python and Java and I wanted to use PHP but this individual was trying it too a month back and well ok.
So I got the thing set up, and Google’s site was talking to my site, and passing me the special HTTP_GOOGLE_CODE_PROJECT_HOSTING_HOOK_HMAC variable (not important). But the problem was the $_POST variables I was getting were empty. As in zero. And $_REQUEST didn’t have it, and there were no $_FILES, so where was the JSON? And that’s when I googled
some a lot more and came across a thing I’ve never ever seen in all Seven Years of coding PHP, which is the existence of something called raw POST data. All you need is this:
This will show you the JSON data that Google is posting to your page. I know. I make it seem so easy!