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
978 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
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,
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;
}