This repository has been archived on 2023-08-24. You can view files and clone it, but cannot push or open issues or pull requests.
athena.fb-infra.uk/php/submitIssue.php

42 lines
976 B
PHP
Raw Permalink Normal View History

2022-09-20 19:22:01 +01:00
<?php
2022-09-18 20:39:32 +01:00
2022-09-20 20:36:00 +01:00
function sendInput($title,$body) {
2022-09-20 19:22:01 +01:00
// Get API Key for git.fjla.uk
2022-11-26 15:28:55 +00:00
require '/srv/keys/athena/apiKeys.php';
2022-09-20 19:22:01 +01:00
// Set httpHeaders
$httpHeaders = array(
"accept: application/json",
$giteaKey,
"Content-Type: application/json"
);
// Prepare the request
$rawData = array(
'body' => $body,
2022-09-20 20:40:29 +01:00
'title' => $title
2022-09-20 19:22:01 +01:00
);
$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;
}
2022-09-20 20:36:00 +01:00
function cleanInput($data) {
$data = trim($data);
$data = stripslashes($data);
$data = htmlspecialchars($data);
return $data;
}