In BitBucket I setup a Push webhook. On the receiving side I log the data sent in the post. With a webhook I always get an empty POST array. No Payload.
If I do exactly the same thing using the deprecated Push Services it works fine. So I know I'm triggering it correctly. I even tried leaving both the Service and the WebHook active at the same time. Still blank from the WebHook. Any ideas why?
Something like this should work.
$inputJSON = file_get_contents('php://input'); $input= json_decode( $inputJSON, TRUE ); //convert JSON into array
http://stackoverflow.com/questions/7047870/issue-reading-http-request-body-from-a-json-post-in-php
That did it. Thanks! Now I find that what is sent doesn't have any of the information I need like what's being pushed. Mutter mutter.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
That is coming soon.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
What are you using to consume the webhook payload?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
At this point I'm just logging the POST info to a log file to keep it simple. PHP script <?php error_log(print_r($_REQUEST, true), 3, 'logfile.txt'); Can't get much simpler. Return the following depenfing on whether WebHoook or Service. So it's the right trigger. Array //webook ( ) Array //service ( [payload] => {"repository": {"website": "", "fork": false, "name": "DGC Ticker", "scm": "git", "owner": "arkytn", "absolute_url": "/arkytn/dgc-ticker/", "slug": "dgc-ticker", "is_private": true}, "truncated": false, "commits": [{"node": "8257c2e8e27c", "files": [{"type": "modified", "file": "assets/cmb2/readme.txt"}], "raw_author": "arkytn <abaileytn@gmail.com>", "utctimestamp": "2015-08-06 14:46:16+00:00", "author": "arkytn", "timestamp": "2015-08-06 16:46:16", "raw_node": "8257c2e8e27ca634b197c2e86c8b88588e0159f4", "parents": ["2546922f721e"], "branch": "master", "message": "Deploy test\n", "revision": null, "size": -1}], "canon_url": "https://bitbucket.org";, "user": "arkytn"} )
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.