webhook empty
# support
d
hi, i have successfuly configured and endpoint to receive webhook on my server, the call are made but result is empty on a simple php script who log what you send , it's empty $json = file_get_contents('php://input'); file_put_contents("brut.json", $json); thank you
v
@drpark Hello! It's great to hear that you've successfully configured an endpoint to receive webhooks on your server. If the calls are being made but the result is empty, there could be a few reasons for this. Here are some steps you can take to troubleshoot the issue: 1. **Check the Content-Type**: Ensure that the sender of the webhook is sending the data with the correct
Content-Type
header (e.g.,
application/json
for JSON data). 2. **Verify Sender Data**: Confirm that the service sending the webhook is actually including data in the body of the request. 3. **Logging Raw Request**: Instead of just capturing
php://input
, you might want to log the entire raw request to see if there are any headers or other information that could help you debug. 4. **Error Handling**: Add error handling in your PHP script to check if
file_get_contents('php://input')
is returning false or an empty string. 5. **Server Configuration**: Check your server configuration to ensure that it's not stripping out the body of POST requests. 6. **PHP Configuration**: Ensure that
allow_url_fopen
is enabled in your
php.ini
file, as this setting allows PHP to read input from
php://input
. Here's an updated version of your PHP script with added error handling:
Copy code
php
<?php
$json = file_get_contents('php://input');

if ($json === false) {
    file_put_contents("error.log", "Error reading input stream.\n", FILE_APPEND);
} elseif ($json === '') {
    file_put_contents("error.log", "No data received in input stream.\n", FILE_APPEND);
} else {
    file_put_contents("brut.json", $json);
}
?>
If after trying these steps you're still facing issues, please provide more details or check with the service sending the webhooks to ensure they are sending the expected data.
You can continue this conversation by mentioning me in the message.
d
thank you, the webhook should arrive directly fromyou
end of call report
No data received in input stream. No data received in input stream. No data received in input stream.
you service is calling
but without data inside
i guess the porbleme is on the server security side
OK solved