<?php
namespace BoostN\Slack\Service;
use XF\Service\AbstractService;
class SlackNotify extends AbstractService
{
public function postToSlack(array $payload)
{
$app = \XF::app();
$epayload = json_encode($payload);
$webHook = $app->options()->boostnSlackwebHook;
$ch = curl_init($webHook);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $epayload);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
$response = curl_exec ($ch); // execute
curl_close ($ch); // close curl handle
return $response;
}
}