Advertisement
davidfcarr

Untitled

Dec 18th, 2015
714
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.06 KB | None | 0 0
  1. function glip_webhook($webhook_url,$title, $body, $activity,$icon ='' ) {
  2.  
  3. $json = json_encode(array('icon'=>$icon,'activity'=>$activity,'title'=>$title,'body'=>$body) );
  4.  
  5. $ch = curl_init($webhook_url);                                                                    
  6. curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");                                                                    
  7. curl_setopt($ch, CURLOPT_POSTFIELDS, $json);                                                                  
  8. curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);                                                                      
  9. curl_setopt($ch, CURLOPT_HTTPHEADER, array(                                                                          
  10.     'Content-Type: application/json',                                                                                
  11.     'Content-Length: ' . strlen($json))                                                          
  12. );                                                                                  
  13. $r = curl_exec($ch);
  14. return $r;
  15. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement