从Hubspot Webhook捕获JSON数据

编程入门 行业动态 更新时间:2024-10-27 12:30:43
本文介绍了从Hubspot Webhook捕获JSON数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

对于我的一生,我无法弄清自己的缺失.我正在使用HubSpot,并且具有工作流程设置以使用发布到我拥有的脚本的Web挂钩.当我设置网址以将webhook数据捕获到requestb.in时,它传递了数据,并且可以看到原始的json数据.但是,当我尝试用自己的代码捕获它并将其写入文本文件时,我什么也没得到.

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.

我尝试过类似的事情:

$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);

无论做什么,我都无法捕获从Webhook发布的数据.

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

这是我的问题.在正常过程中,当从api发布json数据时, 我是否正确要求json数据的变量"通常是消息" (例如:$ _ POST ['message'])?

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'])?

我想问一个关于我丢失或做错什么的指针,这将使我无法捕获这些数据.我真的开始以为是HubSpot,而不是我,但我需要先确认一下.

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.

谢谢

推荐答案

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

I had luck with using this code at the top: $_POST = file_get_contents('php://input');

更多推荐

从Hubspot Webhook捕获JSON数据

本文发布于:2023-10-11 04:43:22,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1480714.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:数据   Hubspot   Webhook   JSON

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!