Files
thetool/lib/SNOPP/SNOPP.php
2025-02-04 19:56:33 +01:00

37 lines
821 B
PHP

<?php
/**
* Represents the SNOPP API.
*/
class SNOPP {
/**
* SNOPP constructor.
*/
public function __construct() {}
/**
* Search for support tickets using the SNOPP API.
* @return array - The search results.
*/
function getSNOPPTickets(): array {
$SNOPP_API_URL = SNOPP_API_URL;
$SNOPP_API_KEY = SNOPP_API_KEY;
$ctx_opts = [
'http' => [
'method' => 'GET',
'header' => "X-Api-Key: $SNOPP_API_KEY\r\n",
]
];
$snopp_output = file_get_contents("$SNOPP_API_URL/ticket/find?provider_id=all&status=open", false, stream_context_create($ctx_opts));
$ticket_obj = json_decode($snopp_output);
$tickets = $ticket_obj->result->tickets;
return $tickets;
}
}
?>