Further changes of test scrupt

This commit is contained in:
Fred Boniface 2022-09-19 19:46:34 +01:00
parent f2f0d33e61
commit c70c7637a3

View File

@ -2,6 +2,8 @@
// Get API Key for git.fjla.uk // Get API Key for git.fjla.uk
$giteaKey = "Authorization: token d9e748bbca7b662dbd946854e57ae0213d0e8f88"; $giteaKey = "Authorization: token d9e748bbca7b662dbd946854e57ae0213d0e8f88";
echo "Gitea AUTH header is: $giteaKey";
// Set httpHeaders // Set httpHeaders
$httpHeaders = array( $httpHeaders = array(
"accept: application/json", "accept: application/json",
@ -13,6 +15,8 @@
$body = "This is a PHP-CLI test issue."; $body = "This is a PHP-CLI test issue.";
$subject = "Test Issue"; $subject = "Test Issue";
echo "Prepared POST data:\nSubject: $subject\nBody:$body";
// Prepare the request // Prepare the request
$rawData = array( $rawData = array(
'body' => $body, 'body' => $body,
@ -22,6 +26,8 @@
$issueData = json_encode($rawData); $issueData = json_encode($rawData);
echo "Ready to send data:\n$issueData"
// Prepare CURL // Prepare CURL
$curlConnection = curl_init('https://git.fjla.uk/api/v1/repos/fred.boniface/athena.fb-infra.uk/issues'); $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_POSTFIELDS, $issueData);
@ -32,6 +38,5 @@
$giteaResponse = curl_exec($curlConnection); $giteaResponse = curl_exec($curlConnection);
curl_close($curlConnection); curl_close($curlConnection);
echo $issueData . "\n\n"; echo "Response: " . $giteaResponse;
echo $giteaResponse;
?> ?>