Following to this page...
https://developer.atlassian.com/jiradev/api-reference/jira-rest-apis/jira-rest-api-tutorials/jira-rest-api-example-basic-authentication
We need to use header authentication these days which looks - modifying the example in this tread - like:
$username = 'user';
$password = 'pass';
$url = 'https://www.jiradomain.com/rest/api/2/issue/PROJECT-321/worklog';
$curl = curl_init();
curl_setopt($curl, CURLOPT_HTTPHEADER, array('Authorization: Basic ' . base64_encode("$username:$password")) );**
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($curl, CURLOPT_VERBOSE, true);
$verbose = fopen('php://temp', 'rw+');
curl_setopt($curl, CURLOPT_STDERR, $verbose);
$issue_list = (curl_exec($curl));
echo $issue_list;
$result = curl_exec($curl);
if ($result === FALSE) {
printf("cUrl error (#%d): %s<br>\n", curl_errno($curlHandle),
htmlspecialchars(curl_error($curlHandle)));
}
rewind($verbose);
$verboseLog = stream_get_contents($verbose);
echo "Verbose information:\n<pre>", htmlspecialchars($verboseLog), "</pre>\n";