Last active
January 3, 2016 22:09
-
-
Save yudanta/8526201 to your computer and use it in GitHub Desktop.
simple php script to handle gitlab webhook post data
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
try { | |
if ($HTTP_RAW_POST_DATA) | |
{ | |
if ($git_hook_data = json_decode($HTTP_RAW_POST_DATA)) | |
{ | |
$fn = fopen('hook.log.txt', 'w') or die('cant open file'); | |
fwrite($fn, "hook data received at: ".date('Y-m-d H:i:s')."\n"); | |
fwrite($fn, print_r($git_hook_data, true)); | |
fclose($fn); | |
} | |
} | |
else | |
{ | |
$fn = fopen('hook.log.txt', 'w'); | |
fwrite($fn, 'no post received'); | |
fclose($fn); | |
} | |
} catch (Exception $e) { | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment