'http://206.225.81.36:8989/api/messaging/sendsms', CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => '', CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 0, CURLOPT_FOLLOWLOCATION => true, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => 'POST', CURLOPT_POSTFIELDS => $params, CURLOPT_HTTPHEADER => array( 'Content-Type: application/json', 'Authorization: Bearer ' . SMS_API_KEY ), )); $response = curl_exec($curl); curl_close($curl); return $response; } function slackCurl($message){ $curl = curl_init(); curl_setopt_array($curl, array( CURLOPT_URL => "https://hooks.slack.com/services/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", CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => "", CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 30, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => "POST", CURLOPT_POSTFIELDS => $message, CURLOPT_HTTPHEADER => array( "cache-control: no-cache", "content-type: application/json" ), )); $response = curl_exec($curl); $err = curl_error($curl); curl_close($curl); if ($err) { return "cURL Error #:" . $err; } else { return $response; } } function sendSlack($message){ $retval = array('text' => $message); $response = slackCurl(json_encode($retval)); return $response; } function sendNtfy($data){ $curl = curl_init(); curl_setopt_array($curl, array( CURLOPT_HTTPHEADER => array( 'Content-Type: application/json' ), CURLOPT_URL => 'https://ntfy.sh/bpc_rest_api', CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => '', CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 0, CURLOPT_FOLLOWLOCATION => true, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => 'POST', CURLOPT_POSTFIELDS => $data )); $response = curl_exec($curl); return $response; } ?>