테스트 사이트 - 개발 중인 베타 버전입니다

slack webhook 관련 자료

· 6년 전 · 2508 · 1

curl로 연동하는 부분 입니다.

[code]

$data = array(
   'channel'     => $slack->channel,
   'username'    => $slack->username,
   'text'        => $message['body'],
   //'icon_emoji'  => $icon,
   //'attachments' => $attachments
);

echo "--- pass --->>" . PHP_EOL;
echo print_r($data, true) . PHP_EOL;

$data_string   = json_encode($data);
$ch = curl_init($slack->slack_url);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
   'Content-Type: application/json',
   'Content-Length: ' . strlen($data_string))
);
$result = null;
try {
   //Execute CURL
   $result = curl_exec($ch);
} catch(\Exception $e) {
}

[/code]

댓글 작성

댓글을 작성하시려면 로그인이 필요합니다.

로그인하기

댓글 1개

6년 전
좋은정보 감사합니다.

게시글 목록

번호 제목
18200
18195
18193
18181
18179
18173
18170
18164
18158
18155
18152
18151
18150
18140
18139
18138
18131
18130
18120
18119
18118
18117
18116
18111
18110
18108
18107
18106
18100
18090