If I run this curl command from the command line it works like a dream and I get a json array back
$ curl -u chris@christaylordeveloper.co.uk:my-api-token-here -X GET -H "Content-Type: application/json" https://christaylordeveloper.atlassian.net/rest/api/3/issue/KMCI-2/worklog
When I run the equivalent command from php:
<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://christaylordeveloper.atlassian.net/rest/api/3/issue/KMCI-2/worklog');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'GET');
curl_setopt($ch, CURLOPT_USERPWD, 'chris@christaylordeveloper.co.uk' . ':' . 'my-api-token-here');
$headers = array();
$headers[] = 'Content-Type: application/json';
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$result = curl_exec($ch);
if (curl_errno($ch)) {
echo 'Error: ' . curl_error($ch);
}
curl_close ($ch);
I get the following error
Error: Could not resolve host: christaylordeveloper.???atlassian.???net
(including the question marks)
I have tried this PHP script from inside a Symfony app in Docker on my laptop and the same app on a GoDaddy server.
Could anyone explain what I'm doing wrong please?