php-integration #21
37
php/submitIssue-cli-test.php
Normal file
37
php/submitIssue-cli-test.php
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
<?php
|
||||||
|
// Get API Key for git.fjla.uk
|
||||||
|
$giteaKey = "Authorization: token d9e748bbca7b662dbd946854e57ae0213d0e8f88";
|
||||||
|
|
||||||
|
// Set httpHeaders
|
||||||
|
$httpHeaders = array(
|
||||||
|
"accept: application/json",
|
||||||
|
$giteaKey,
|
||||||
|
"Content-Type: application/json"
|
||||||
|
);
|
||||||
|
|
||||||
|
// Prepare $detail to POST
|
||||||
|
$body = "This is a PHP-CLI test issue.";
|
||||||
|
$title = "Test Issue";
|
||||||
|
|
||||||
|
// Prepare the request
|
||||||
|
$rawData = array(
|
||||||
|
'body' => $body,
|
||||||
|
'title' => $subject,
|
||||||
|
'closed' => 'false'
|
||||||
|
);
|
||||||
|
|
||||||
|
$issueData = 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, $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);
|
||||||
|
|
||||||
|
echo $issueData . "\n\n";
|
||||||
|
echo $giteaResponse;
|
||||||
|
?>
|
Reference in New Issue
Block a user