Setting up POST Service - receive-hook data not formatting?

Hey. I'm new to both BitBucket and to git, and I'm struggling. I've got a simple POST service I'm trying to setup based on this code: (walk-through: & code:

It's not firing, and I've managed to work out why - the data in the $_POST variable isn't being accessed correctly. I've setup a `mail` function to email me the output and when I run `implode(',', $_POST)` and output the data, I get this in return:

{\"repository\": {\"website\": \"\", \"fork\": false, \"name\": \"test\", \"scm\": \"git\", \"owner\": \"me\", \"absolute_url\": \"/me/test/\", \"slug\": \"test\", \"is_private\": true}, \"user\": \"me\", \"truncated\": false, \"commits\": [{\"node\": \"5347dd04bbfd\", \"files\": [{\"type\": \"modified\", \"file\": \"index.html\"}], \"branch\": \"master\", \"utctimestamp\": \"2013-05-25 01:11:41+00:00\", \"timestamp\": \"2013-05-25 03:11:41\", \"raw_node\": \"5347dd04bbfd7c63e380985a5878dd3f34275994\", \"message\": \"testing remote push\\n\", \"size\": -1, \"author\": \"me\", \"parents\": [\"56eda188f077\"], \"raw_author\": \"My Name <>\", \"revision\": null}], \"canon_url\": \"\"}

This doesn't look right and it also means that when i try to access $_POST['payload'] or any other variable combo, it's coming up empty.

What am I doing wrong??

1 answer

Hi Tiffani,

Have you emailed the owner of that github repo? Looks like he responds to posts on the blog.


thanks for replying. I have emailed him with nothing back yet. I thought I'd ask here, as the question really didn't involve the code that was being questioned. I put the email and output at the very beginning of the code, so that the first thing that happens is the output to email and the $_POST data isn't coming through like i'd expect. I can't figure out how to get the POST data out into a usable format. The problem is actually separate to the rest of the code.

Suggest an answer

Log in or Join to answer
Community showcase
Jason Wong
Published yesterday in Agility Beta

Welcome to agility

Every team in the world is unique, and so   Atlassian believes   that each and every team's best way of working  needs to  be molded to their unique circumstances  – ...

391 views 6 16
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot