<?php
$ch = curl_init();
$fields='{"input": {"name": "Titulo ABCD","content": "Descricao 1234"}}';
curl_setopt($ch, CURLOPT_URL, 'http://localhost/glpi/apirest.php/Ticket/');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $fields);
curl_setopt($ch, CURLOPT_POST, 1);
$headers = array();
$headers[] = 'Content-Type: application/json';
$headers[] = 'Session-Token: 6c4f680e5581ca31008809b3236f6ac4';
$headers[] = 'App-Token: 7mvDUHjK21WB19banyJJNWTegjpEQlwslVODeOPJ';
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$result = curl_exec($ch);
if (curl_errno($ch)) {
echo 'Error:' . curl_error($ch);
}
curl_close($ch);
var_dump($result);
?>
Últimos comentários