<?php

$payload = json_decode(file_get_contents('php://input'));

if ($payload) {
  file_put_contents('/var/www/controversial.io/webhook-test.json', file_get_contents('php://input'));
  shell_exec('cd /var/www/controversial.io');
  shell_exec('git pull');
  shell_exec('npm install');
  shell_exec('gulp build');
  echo('done');
}

?>

<?php

$payload = json_decode(file_get_contents('php://input'));

if ($payload) {
  echo(shell_exec('cd /var/www/controversial.io 2>&1'));
  echo(shell_exec('git pull 2>&1'));
  echo(shell_exec('npm install 2>&1'));
  echo(shell_exec('gulp build 2>&1'));
  echo('done');
}

?>

Use 2>&1 for enhanced debugging
Use 2>&1 for enhanced debugging
