-
-
Save stephangroen/f9a51c8bbe0f910f4e80 to your computer and use it in GitHub Desktop.
Receiving a JSON hook
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Fetch the entire body to a variable (this will contain the raw data) | |
$webhook = file_get_contents('php://input'); | |
// Decode the JSON to an array | |
$webhook_array = json_decode($webhook, true); | |
// Do some stuff with the data you received, for example write contents to a file | |
file_put_contents('webhook.txt', print_r($webhook_array, true)); | |
// Send a success header, so Picqer knows you have succesfully received the data | |
header('HTTP/1.1 200 OK'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment