늘맑음

slack webhook 관련 자료

· 2019-06-24 (월) 14:02:35 · 3167 · 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개

2019-07-19 (금) 01:58:19
좋은정보 감사합니다.
댓글을 작성하시려면 로그인이 필요합니다.

개발자팁

5,403건

개발과 관련된 유용한 정보를 공유하세요. 질문은 QA에서 해주시기 바랍니다.

+
분류 제목 글쓴이 날짜 조회
jQuery 18-01-25 조회 4,534
JavaScript 18-01-24 조회 8,557
기타 18-01-24 조회 2,814
웹서버 18-01-24 조회 3,069
기타 18-01-22 조회 7,861
기타 18-01-22 조회 5,784
웹서버 18-01-18 조회 6,889
PHP 18-01-12 조회 6,388
jQuery 18-01-10 조회 3,892
jQuery 18-01-10 조회 2,781
jQuery 18-01-10 조회 3,438
MySQL 18-01-08 조회 3,594
jQuery 18-01-08 조회 2,927
jQuery 18-01-08 조회 3,161
jQuery 18-01-08 조회 4,879
PHP 18-01-05 조회 4,817
jQuery 18-01-04 조회 4,616
jQuery 18-01-04 조회 3,248
jQuery 18-01-04 조회 2,690
jQuery 17-12-06 조회 2,875
jQuery 17-12-06 조회 3,641
jQuery 17-12-06 조회 3,464
jQuery 17-12-04 조회 2,843
jQuery 17-12-04 조회 2,098
jQuery 17-12-04 조회 3,043
jQuery 17-12-04 조회 2,909
jQuery 17-11-25 조회 2,713
jQuery 17-11-25 조회 2,651
jQuery 17-11-25 조회 2,336
jQuery 17-11-24 조회 2,391