【发布时间】:2015-08-27 04:39:14
【问题描述】:
我正在尝试从 hipmob(实时聊天应用)接收一个应该在聊天事件中触发的 webhook。
文档:https://www.hipmob.com/documentation/chat-events.html
我一直在关注How to catch the HTTP POST request sent by a Shopify Webhook,我不得不说我对此完全陌生。我尝试了第一个答案的解决方案,但没有成功。
这就是我所做的:
<?php
$webhookContent = "";
$webhook = fopen('php://input' , 'rb');
while (!feof($webhook)) {
$webhookContent .= fread($webhook, 4096);
}
fclose($webhook);
$file = 'webhook.txt';
// Open the file to get existing content
$current = file_get_contents($file);
// Append a new person to the file
// Write the contents back to the file
file_put_contents($file, $current);
error_log($webhookContent);
?>
但没有成功
【问题讨论】: