<?php /** * Installation instructions: * - Place this file into the same directory with the xmlrpc.inc. * - Edit the post-receive hook, so it calls this file with the correct path (example in the readme). * - Edit the configuration options (server, key). * - Profit. */ /** * Configuration */ $server = 'http://localhost/bot/xmlrpc.php'; $key = 'this_is_a_secret_key'; include 'xmlrpc.inc'; post_receive(); /** * Compose an XML-RPC message to the server. */ function send($commit_id, $author, $message) { $method = 'bot_commit.recordCommit'; global $server, $key; $parameters = array($server, $method, $key, $commit_id, $author, $message, $project); // The parameters cant be passed as an array to xmlrpc(). $result = call_user_func_array('_xmlrpc', $parameters); } /** * Show commit information in a certain format. */ function git_show($hash, $format = 'short')
<?php require_once __DIR__ . '/config.php'; require_once __DIR__ . '/lib.php'; function forbidden() { header('HTTP/1.1 403 Forbidden'); exit; } if (!isset($_GET['password']) || $_GET['password'] !== GITHUB_HOOK_PASSWORD || !isset($_POST['payload']) || !post_receive($_POST['payload'])) { forbidden(); } else { echo 'UPDATED'; }