I want to get the data from a curl command in php for further processing.
I am facing an issue with the code when I use it in php. The curl command looks good for me when I run it in the system.
My code is as follows:
<?php
function getJsonFromUrl($urlString) {
$urlData = shell_exec('curl --silent --request GET --url '' . $urlString . '' --user 'root:password' --header 'Accept: application/json'');
$jsonData = json_decode($urlData, true);
return $jsonData;
}
$data = array(
'id' => '',
'parent' => '',
'issueId' => '1931461',
'issueType' => ''
);
$url = "https://jira.myorg.com/rest/dev-status/1.0/issue/detail?issueId={$data['issueId']}&applicationType=stash&dataType=repository";
$jsonData = getJsonFromUrl($url);
?>
I am getting the following errors:
‘applicationType’ is not recognized as an internal or external
command,
operable program or batch file.‘dataType’ is not recognized as an internal or external command,
operable program or batch file.Deprecated: json_decode(): Passing null to parameter #1 ($json) of
type string is deprecated in C:UsersAdministratorDocumentstest.php
on line 4
Please help me with it