I am trying to write the php script to run curl job and here is the curl query to create the ticket
curl -X POST -H "Content-Type: application/json" -H
"username:username" -H "password:password" --data
'{"serviceName":"CREATE_AVENT","keyValues":{"title":
"test","actionableevent_priority": "Minor","source":
"TEC","requester_login": "user"}}' -k
https://createticket.com/arsys/rest/service/createTicket
Here is the script I wrote in php
$url="https://createticket.com/arsys/rest/service/createTicket";
$field=array("serviceName"=>"CREATE_AVENT","keyValues"=>array("title"=>"test","actionableevent_priority"=>"Minor","source"=>"TEC","requester_login"=>"user"));
$data_string = json_encode($field);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt ($ch, CURLOPT_CAINFO, "/var/www/xxx/cacert.pem");
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type:application/json','username:username','password:password'));
$output = curl_exec($ch);
print_r($output);
$info = curl_getinfo($ch);
$err=curl_error($ch);
print_r($err);
print "\n";
curl_close($ch);
When I execute the curl query it returns ticket ID and creates a ticket in the system. However when I run the script it is not returning anything as well as no ticket in the system. Can anybody tell me what is wrong with this script?