PHP Api Integration challenges ticket creation and authorization

I’ve managed to get my php curl integration running with our splynx server and can pull customer info, stats and view tickets.
However I have a challenge with the ticket creation and when including the header authorization
it reports an error that it is missing the auth header. Even though it is there.
I think im adding my array and auth header incorrectly for ticket creation.
Would some one be so kind as to point me in the right direction?

Is it an escape character, or other issue that I’m not seeing in the array?
Any help on the subject would be greatly appreciated.

Below is my code:
this is the error code I receive.

string(252) “{“error”:{“code”:500,“internal_code”:“SERVER_ERROR”,“message”:“Argument 1 passed to base\Model::load() must be of the type array, null given, called in /var/www/splynx/app/controllers/api/v2/admin/support/TicketsController.php on line 190”}}”

<?php 
include '../API/SplynxApi.php';

$api_key = xxxxxxxxxxx';
$api_secret = 'xxxxxxxxxxxxxx';

$headers = array(
	'Content-Type: application/json',
	'Authorization: Basic '. base64_encode("$api_key:$api_secret")
);

$ch = curl_init();
#curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_URL, "http://Y.Y.Y.Y/api/2.0/admin/support/tickets");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ch, CURLOPT_HEADER, FALSE);

curl_setopt($ch, CURLOPT_POST, TRUE);

curl_setopt($ch, CURLOPT_HTTPHEADER, array(
	"Content-Type: application/json",
	'Authorization: Basic '. base64_encode("$api_key:$api_secret"),
	"reporter_id\": \"5039\",
    \"reporter_type\": \"customer\",
    \"customer_id\": \"5039\",
    \"incoming_customer_id\": \"0\",
    \"hidden\": \"0\",
    \"assign_to\": \"60\",
    \"status_id\": \"4\",
    \"group_id\": \"1\",
    \"type_id\": \"2\",
    \"task_id\": 0,
    \"subject\": \"Jo's First Splynx Ticket\",
    \"priority\": \"medium\",
    \"star\": \"0"
));

$response = curl_exec($ch);
curl_close($ch);

var_dump($response);

?>

I’ve realized that in the array, its not expecting the : separately from variable to value of variable.
It wants it, with out the " : " between the variables and variable values.

So I’ve adjusted my code to the following, listed below the error:

However, I am now presented with this error:
string(252) “[
{
“field”: “subject”,
“is_additional_attribute”: false,
“message”: “Subject is required”
},
{
“field”: “priority”,
“is_additional_attribute”: false,
“message”: “Priority is required”
}
]”

<?php 
include '/var/www/html/API/SplynxApi.php';

$api_key = 'key';
$api_secret = 'ssshhhh';

$headers = array(
	'Content-Type: multipart/form-data',
	'Authorization: Basic '. base64_encode("$api_key:$api_secret"),
	'reporter_id: 5039',
    'reporter_type: customer',
    'customer_id: 5039',
    'incoming_customer_id: 0',
    'hidden: 0',
    'assign_to: 60',
    'status_id: 4',
    'group_id: 1',
    'type_id: 2',
    'task_id: 0',
    'subject: My First Splynx Ticket',
    'priority: medium',
    'star: 0'
);

$ch = curl_init();
#curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_URL, "http://serverip/api/2.0/admin/support/tickets");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ch, CURLOPT_HEADER, FALSE);

curl_setopt($ch, CURLOPT_POST, TRUE);

curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);

$response = curl_exec($ch);
curl_close($ch);

var_dump($response);

?>

Can you please check example how to use API ?

https://bitbucket.org/splynx/splynx-php-api/src/master/examples/v2_example.php

No need to put any information (except auth) to header.

It should be on body, and as a json.

Or just use API class and check example.