简体   繁体   中英

Catching json data from hubspot webhook

For the life of me I can't figure out what I am missing. I am using HubSpot and have a workflow setup to use a web hook that posts to a script that I have. When I set the url to capture the webhook data onto requestb.in it passed the data and I can see the raw json data. But when I try to capture it with my own code and write it to a text file, I get absolutely nothing.

I have tried things like:

$myFile = "testFile.txt";
$fh = fopen($myFile, 'w') or die("can't open file");

fwrite($fh, $_POST);
fwrite($fh, $_GET);
fwrite($fh, $_REQUEST);
fwrite($fh, $_POST['message']);
fwrite($fh, $_GET['message']);

fclose($fh);

And no matter what I do - I can't capture the data being posted from the webhook.

So here's my question. In a normal procedure, when json data is posted from an api, am I correct in asking that the "variable" of the json data is usually "message" (For example: $_POST['message'])?

And I would kindly ask a pointer as to what I am missing or doing wrong that won't allow me to capture this data. I am really beginning to think it's HubSpot and not me, but I need to confirm that first.

Thanks

我在顶部使用这个代码很幸运:$ _POST = file_get_contents('php:// input');

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