drpark
11/30/2024, 2:02 PMVapi
11/30/2024, 2:05 PMContent-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:
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.Vapi
11/30/2024, 2:05 PMdrpark
11/30/2024, 2:07 PMdrpark
11/30/2024, 2:07 PMdrpark
11/30/2024, 2:08 PMdrpark
11/30/2024, 2:09 PMdrpark
11/30/2024, 2:09 PMdrpark
11/30/2024, 2:31 PMdrpark
11/30/2024, 6:00 PM