Pipedrive Webhook PHP endpoint code example
Get the solution ↓↓↓I have setup a webhook from Pipedrive to activate on a deal being updated. I am struggling with the correct way to read the json response in php. I am new to Webhooks so is there another way of reading the response data. This is what I have:
<?php
$result = $_REQUEST['current']; // this is where it is not working I believe
$obj = json_decode($result, true);
$txt = $obj['id']
$myfile = fopen("newfile.txt", "w") or die("Unable to open file!");
fwrite($myfile, $txt);
fclose($myfile);
In requestbin I am getting a response with all the correct information I am expecting
It appears that body of the event contains an array called "current" with all the relevant data in and I wanted to extract the "id" to see it working
"body": {
"current": {
"id": 71}
Any help really appreciated
Answer
Solution:
I have found an answer that shows me what I require
$result = file_get_contents("php://input");
This pulls back the full response from the server showing data
Share solution ↓
Additional Information:
Link To Answer People are also looking for solutions of the problem: constant expression contains invalid operations
Didn't find the answer?
Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.
Similar questions
Find the answer in similar questions on our website.
Write quick answer
Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.