php-integration #21
@ -25,7 +25,32 @@
|
|||||||
$subject = validate($_POST["subject"]);
|
$subject = validate($_POST["subject"]);
|
||||||
$detail = validate($_POST["detail"]);
|
$detail = validate($_POST["detail"]);
|
||||||
|
|
||||||
// ENTER CODE TO SUBMIT TO GITEA & DISPLAY SUCCESS MSG HERE
|
// Get API Key for git.fjla.uk
|
||||||
|
$giteaKey = file_get_contents('/srv/php-keys/athena/gitea');
|
||||||
|
|
||||||
|
// Set httpHeaders
|
||||||
|
$httpHeaders = array(
|
||||||
|
"accept: application/json",
|
||||||
|
$giteaKey,
|
||||||
|
"Content-Type: application/json"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Prepare the request
|
||||||
|
$issueData = array(
|
||||||
|
'body' => $_POST["subject"],
|
||||||
|
'title' => $_POST["detail"],
|
||||||
|
'closed' => 'false'
|
||||||
|
)
|
||||||
|
|
||||||
|
// Prepare CURL
|
||||||
|
$curlConnection = curl_init('https://git.fjla.uk/api/v1/repos/fred.boniface/athena.fb-infra.uk/issues');
|
||||||
|
curl_setopt($curlConnection, CURLOPT_POSTFIELDS, $issueData);
|
||||||
|
curl_setopt($curlConnection, CURLOPT_RETURNTRANSFER, true);
|
||||||
|
curl_setopt($curlConnection, CURLOPT_HTTPHEADER, $httpHeaders);
|
||||||
|
|
||||||
|
// Get response and exit CURL
|
||||||
|
$giteaResponse = curl_exec($curlConnection);
|
||||||
|
curl_close($curlConnection);
|
||||||
}
|
}
|
||||||
|
|
||||||
function validate($data) {
|
function validate($data) {
|
||||||
@ -66,6 +91,9 @@
|
|||||||
<input type="submit">
|
<input type="submit">
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
|
<p>You have submitted:</p>
|
||||||
|
<p><?php echo $giteaResponse?>
|
||||||
|
|
||||||
<!-- Footer -->
|
<!-- Footer -->
|
||||||
<footer>
|
<footer>
|
||||||
<p>Created by Fred Boniface - v0.4.0-devel</p>
|
<p>Created by Fred Boniface - v0.4.0-devel</p>
|
||||||
|
Reference in New Issue
Block a user