Freshdesk API не работает для добавления билетов

Я пытаюсь создать билет Freshdesk с использованием API Freshdesk в php curl.
по этой ссылке на документацию https://github.com/freshdesk/fresh-samples/tree/master/php_samples
Но это не создает билет

    <?php
$fd_domain = "http://test.freshdesk.com";
$token = "apikey";
$password = "xxx";
$email = "[email protected]";
$data = array(
"helpdesk_ticket" => array(
"description" => "Some details on the issue ...",
"subject" => "TEST Support needed..",
"email" => "[email protected]",
"priority" => 1,
"status" => 2
),
"cc_emails" => "[email protected],[email protected]");
$json_body = json_encode($data, JSON_FORCE_OBJECT | JSON_PRETTY_PRINT);
$header[] = "Content-type: application/json";
$connection = curl_init("$fd_domain/helpdesk/tickets.json");
curl_setopt($connection, CURLOPT_RETURNTRANSFER, true);
curl_setopt($connection, CURLOPT_HTTPHEADER, $header);
curl_setopt($connection, CURLOPT_HEADER, false);
curl_setopt($connection, CURLOPT_USERPWD, "$email:$password");
curl_setopt($connection, CURLOPT_POST, true);
curl_setopt($connection, CURLOPT_POSTFIELDS, $json_body);
curl_setopt($connection, CURLOPT_VERBOSE, 1);
$response = curl_exec($connection);
echo $response;
?>

когда я запускаю этот файл в терминале как php file.php, но тикет не работает, я получаю следующие результаты консоли
Но я не уверен, что происходит.

* Hostname was NOT found in DNS cache
*   Trying 107.22.197.253...
* Connected to test.freshdesk.com (107.22.197.253) port 80 (#0)
* Server auth using Basic with user '[email protected]'
> POST /helpdesk/tickets.json HTTP/1.1
Authorization: Basic bW9oYW5Ad2h5YWJsZS5jb206bW9oYW4xMjM=
Host: test.freshdesk.com
Accept: */*
Content-type: application/json
Content-Length: 274

* upload completely sent off: 274 out of 274 bytes
< HTTP/1.1 302 Found
< Cache-Control: no-cache
< Content-Type: text/html; charset=utf-8
< Location: https://test.freshdesk.com/helpdesk/tickets.json
< Set-Cookie: helpdesk_node_session=0fbdb53a62fff9b78f57d069a7abfde86bef1e16eefa8710dbcadb99a1723a3a42affa906dd23ceb6e77f20f0a0e703a2cb6d3423cb94ec074f0006dadfe4b02; path=/
< Set-Cookie: _helpkit_session=BAh7CDoPc2Vzc2lvbl9pZCIlMzdmNGI4ZDZkZWMxNmRhNDBkYWI1ZTFiODU2NDFkODhJIhV1c2VyX2NyZWRlbnRpYWxzBjoGRUZJIgGAZmYxMmExZWJjZGFiMTlkMjgxYjlkYmI0NjIwZjdhMjFlYTgxM2YyZWE5M2UzYTk0MTlhYzBhNDA2M2QyMzEwNTdmNDQ4NjVjYmE1MjA1ZjU2ODUzNGI2ZGQ4NTExZjljZGUyZGQxNzViMzNjMzhkZTYxMTc1MDRkMWE2MGMyOTEGOwZUSSIYdXNlcl9jcmVkZW50aWFsc19pZAY7BkZsKwj%2B0TIqAQA%3D--fdc65abdf0bdcf0c38db4837f05b19050ef1a2f0; path=/; HttpOnly
< Status: 302
< X-Runtime: 25
< Content-Length: 117
< Connection: keep-alive
<
* Connection #0 to host test.freshdesk.com left intact
<html><body>You are being <a href="https://test.freshdesk.com/helpdesk/tickets.json">redirected</a>.</body></html>

пожалуйста, помогите мне

0

Решение

Задача ещё не решена.

Другие решения

Других решений пока нет …

По вопросам рекламы [email protected]