From dc44deb343f6fa454fb39f3c224ce762337e4387 Mon Sep 17 00:00:00 2001 From: "fred.boniface" Date: Tue, 20 Sep 2022 19:22:01 +0100 Subject: [PATCH] Create submitToGitea(...) function --- php/submitIssue.php | 35 +++++++++++++++++++++++++++++++++-- 1 file changed, 33 insertions(+), 2 deletions(-) diff --git a/php/submitIssue.php b/php/submitIssue.php index 402f0ce..e1cae27 100644 --- a/php/submitIssue.php +++ b/php/submitIssue.php @@ -1,3 +1,34 @@ -THIS FILE WILL CONTAIN THE FUNCTIONS NEEDED TO SUBMIT AN ISSUE TO gitea + $body, + 'title' => $subject + ); + + $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; +}