Reputation: 1485
I'm trying to track my users' file changes with Dropbox's Webhooks interface. I expected the call to include POST data, but there doesn't seem to be POST data (or GET data, for that matter). Here is my PHP code, where the if
part is for Dropbox to validate the webhook, and the else
part saves the $_POST
and $_GET
variables to a file.
<?php
if( isset( $_GET['challenge'] ) ) {
echo $_GET['challenge'];
} else {
$output = print_r($_POST, true);
file_put_contents('file.txt', $output, FILE_APPEND );
$output = print_r($_GET, true);
file_put_contents('file.txt', $output, FILE_APPEND );
}
?>
After a short while, file.txt
fills up with this:
Array
(
)
Array
(
)
Upvotes: 0
Views: 261
Reputation: 1485
Following this answer to a related question, you need to get the JSON data like this:
$output = file_get_contents('php://input');
Or, since it's JSON:
$output = json_decode( file_get_contents('php://input') );
Upvotes: 1