42 lines
978 B
PHP
42 lines
978 B
PHP
<?php
|
|
|
|
function sendInput($title,$body) {
|
|
|
|
// Get API Key for git.fjla.uk
|
|
require '/srv/php-keys/athena/gitea.php';
|
|
|
|
// Set httpHeaders
|
|
$httpHeaders = array(
|
|
"accept: application/json",
|
|
$giteaKey,
|
|
"Content-Type: application/json"
|
|
);
|
|
|
|
// Prepare the request
|
|
$rawData = array(
|
|
'body' => $body,
|
|
'title' => $title
|
|
);
|
|
|
|
$preparedData = json_encode($rawData);
|
|
|
|
// Prepare CURL
|
|
$curlConnection = curl_init('https://git.fjla.uk/api/v1/repos/fred.boniface/athena.fb-infra.uk/issues');
|
|
curl_setopt($curlConnection, CURLOPT_POSTFIELDS, $preparedData);
|
|
curl_setopt($curlConnection, CURLOPT_RETURNTRANSFER, true);
|
|
curl_setopt($curlConnection, CURLOPT_HTTPHEADER, $httpHeaders);
|
|
|
|
// Get response and exit CURL
|
|
$response = curl_exec($curlConnection);
|
|
curl_close($curlConnection);
|
|
|
|
return $response;
|
|
}
|
|
|
|
function cleanInput($data) {
|
|
$data = trim($data);
|
|
$data = stripslashes($data);
|
|
$data = htmlspecialchars($data);
|
|
return $data;
|
|
}
|