Exemplo n.º 1
0
    $user = $users[$user];
} elseif ($user != null) {
    echo "ERROR: Invalid username: {$user}.\n\n";
    exit(1);
}
$regex = '/^(19|20)\\d\\d[\\-\\/.](0[1-9]|1[012])[\\-\\/.](0[1-9]|[12][0-9]|3[01]) ([01]?[0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]$/';
if ($date != null && !preg_match($regex, $date)) {
    echo "ERROR: Invalid date format: {$date}.\n";
    echo "Use this date format: YYYY-MM-DD HH:MM:SS\n\n";
    exit(1);
}
######################
#  GLPI Integration  #
######################
// Init GLPI integration class
$GlpiWebService = new GlpiWebService();
$GlpiWebService->url = "http://www.yourglpi.com/plugins/webservices/soap.php";
$GlpiWebService->ws_user = '******';
// OPTIONAL Web service user
$GlpiWebService->ws_pass = '';
//OPTIONAL
$GlpiWebService->glpi_user = '******';
// GLPI user
$GlpiWebService->glpi_pass = '******';
// Connect and automatically login
if (!$GlpiWebService->connect()) {
    echo $GlpiWebService->getErrors() . "\n\n";
    exit(1);
}
$solutionType = 3;
//ID of your solution type
 * GLPI WebService Integration
 * 
 * @author diego.pessanha
 * @since 2014-10-09
 *
 * Utiliza a classe GlpiWebService para integrar com o glpi via soap
 */
error_reporting(E_ALL);
ini_set('display_errors', 1);
include_once dirname(__FILE__) . "/glpiws.class.php";
echo "\n*** GLPI SOAP Integration ***\n\n";
######################
#  GLPI Integration  #
######################
// Init GLPI integration class
$GlpiWebService = new GlpiWebService();
$GlpiWebService->url = "http://www.yourglpi.com/plugins/webservices/soap.php";
$GlpiWebService->ws_user = '******';
// OPTIONAL Web service user
$GlpiWebService->ws_pass = '';
//OPTIONAL
$GlpiWebService->glpi_user = '******';
// GLPI user
$GlpiWebService->glpi_pass = '******';
// Connect and automatically login
if (!$GlpiWebService->connect()) {
    echo $GlpiWebService->getErrors() . "\n\n";
    exit(1);
}
// Ticket information
$ticket = array('content' => "Description", 'status' => 1, 'type' => 1, 'urgency' => 2, 'impact' => 2, 'category' => 155, 'item' => 534, 'itemtype' => 'Computer', 'title' => "Ticket Title (Example)", 'source' => 'WebServices', 'date' => '2014-11-10 01:12:30');