Have you set up a Dropbox API webhook and are having trouble receiving the data sent by Dropbox to your app?
The reason for this is likely to be the encoding of the data. Dropbox doesn’t send the data as form data as you would expect (ie application/x-www-form-urlencoded or multipart/form-data) and therefore you can’t simply fetch the data using $_POST (which is designed as a wrapper for form encoded data).
The solution is to get the raw request (minus the headers) using the following code:
$raw_data = file_get_contents('php://input');
You’ll then need to json_decode the data, as Dropbox sends your app user IDs of users with changes in a JSON format.
If you haven’t used webhooks yet – they’re great for when you have an app that is monitoring a Dropbox folder. There is no need to constantly poll for changes, let Dropbox notify you when something is changed!
If you have any questions, or need more advice on the Dropbox API, please add a comment…
2 Responses to How to receive data from a Dropbox API Webhook with PHP
Rahul Gupta February 28, 2017
How i can receive form data as like other webhooks??
prabhakaran May 2, 2017
Dear Sir,
I need full tutorial to access webhooks dropboz with php.Please help me i try all.