웹훅 튜토리얼
튜토리얼
섹션 제목: “튜토리얼”아래의 코드를 참조하여 POST Request Body 처리 기능을 추가합니다. (콜백 URL 주소를 http(s)://웹서버URL/pbconnect 로 가정하여 설정한 샘플코드입니다.)
// $DOCUMENT_ROOT/pbconnect.php
<?php
ini_set("allow_url_fopen", true);
// 팝빌 Webhook Request Body $json_string = file_get_contents('php://input');
// Webhook 메시지 Json parse $connect_message = json_decode($json_string, true);
$connect_message['eventType']; // 이벤트 유형 $connect_message['eventDT']; // 이벤트 실행일시
// Webhook Request에 대한 응답 메시지 반환 echo json_encode(['result' => 'OK']);?>