GET метод получения билетов с помощью zendesk API (php)

Я не очень хорош в php, но я не понимаю, почему мой код не работает, как будто функция даже не запускается, потому что я ничего не получаю, даже ошибка.

вот мой код:

<?php

define("ZDAPIKEY", "MYTOKEN");
define("ZDUSER", "MYUSER");

$lauchnfunction = curlWrap();

/* Note: do not put a trailing slash at the end of v2 */
function curlWrap()
{
    $ch = curl_init();
  $url = "https://cubber.zendesk.com/api/v2/tickets/recent.json";
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
    curl_setopt($ch, CURLOPT_MAXREDIRS, 10 );
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_USERPWD, ZDUSER."/token:".ZDAPIKEY);

    curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");

    curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-type: application/json'));
    curl_setopt($ch, CURLOPT_USERAGENT, "MozillaXYZ/1.0");
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_TIMEOUT, 10);
    $output = curl_exec($ch);
    curl_close($ch);
    $decoded = json_decode($output);
    return $decoded;
  $data = curlWrap("/tickets/recent.json", null, "GET");
  var_dump($data);
}

?>

конечно я заменяю MYTOKEN и MYUSER своей реальной ценностью

0 ответов

Другие вопросы по тегам