Skip to content

Instantly share code, notes, and snippets.

@davidfcarr
Created August 23, 2017 17:24
Show Gist options
  • Save davidfcarr/4bf9182411ecc74d1af79ff74c300dd5 to your computer and use it in GitHub Desktop.
Save davidfcarr/4bf9182411ecc74d1af79ff74c300dd5 to your computer and use it in GitHub Desktop.
<?php
function glip_webhook($webhook_url,$title, $body, $activity,$icon ='' ) {
$json = json_encode(array('icon'=>$icon,'activity'=>$activity,'title'=>$title,'body'=>$body) );
$ch = curl_init($webhook_url);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_POSTFIELDS, $json);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Content-Type: application/json',
'Content-Length: ' . strlen($json))
);
$r = curl_exec($ch);
return $r;
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment