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: http://simianstudios.com/blog/post/using-bitbucket-for-automated-deployment-of-multiple-repositories & code: https://gist.github.com/krisnoble/4692643)

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 <me@xxx.com>\", \"revision\": null}], \"canon_url\": \"https://bitbucket.org\"}

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.

Mary

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 Sign up to answer
Community showcase
Published 5 hours ago in Sourcetree

Tip from the team: configure your repos for hosting goodness!

Supported Platforms macOS Windows We recently introduced support for additional hosting services such as GitHub Enterprise, GitLab (Cloud, Community Edition, Enterprise Edition), and...

48 views 0 1
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