简体   繁体   中英

How to get the data from the executed webhook?

Hey guys? can someone help me, I'm new to php and I'm trying to receive the data from the webhook. so I created a survey in gohighlevel and what I'm trying to accomplish is that I need to receive the data from the survey when the webhook is triggered.

I'm using gohighlevel for the survey and execution of webhook.

I put the test server as the webhook url and in my test server, this is the code.

<?php
    if($json = json_decode(file_get_contents("php://input"), true)) {
        print_r($json);
        $data = $json;
    } else {
        print_r($_GET);
        $data = $_GET;
    }
?>

And the result is just empty array.

Array()

What am I doing wrong here? please help.

edited: replaced $_POST to $_GET, I accidentally put post instead of get.

From the picture it looks like they're querystring parameters, so you'll most likely find them in $_GET rather than $_POST . They certainly aren't being sent as JSON.

eg

$firstname = $_GET["firstname"];
$lastname = $_GET["lastname"];

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM