Where is webhook payload?

Hi, I want use webhook, but I don’t see any payload in $_POST variable.
If i dump $_POST and $_SERVER, $_SERVER is fine, but $_POST is an empty array. Can’t guess where I’m making a mistake?
I try create Gogs application/json webhook.

My environment is own VPS with:

  • Ubuntu 18.04.5 LTS
  • Nginx version: 1.14.0
  • Mariadb 10.1.44
  • PHP version 7.2.24 (NTS)
  • GIT version 2.17.1
  • Go version go1.10.4
  • Gogs version

Hi, I don’t know what $_POST is supposed to have, but the payload is the entire request body sent from Gogs.

I need access to the last commit data.
Previously, this data (JSON) was in the $ _POST[‘payload’] variable. Now I don’t know where to find this data.

I never used PHP so I don’t know why you can’t?

I already understand that. As you write, JSON is in the BODY of request. Previously, it was sent in the payload parameter using the POST method => $_POST[‘payload’].

For others: This is solution for access to data in PHP:

$data = json_decode(file_get_contents('php://input'), true);

Thanks Unknwon! :slight_smile: