Beispiel #1
0
<?php

$CI =& get_instance();
$status = @$_REQUEST['status'];
$flow = @AppletInstance::getFlow();
$flow_id = $flow->id;
$instance_id = AppletInstance::getInstanceId();
function zendesk_client($path, $method = 'GET', $xml = '')
{
    // {{{
    $ch = curl_init();
    curl_setopt_array($ch, array(CURLOPT_URL => ZENDESK_URL . $path, CURLOPT_HTTPAUTH => CURLAUTH_BASIC, CURLOPT_HEADER => FALSE, CURLOPT_FOLLOWLOCATION => TRUE, CURLOPT_USERPWD => ZENDESK_EMAIL . ':' . ZENDESK_PASSWORD, CURLOPT_RETURNTRANSFER => TRUE));
    switch ($method) {
        case 'GET':
            curl_setopt($ch, CURLOPT_HTTPGET, TRUE);
            break;
        case 'POST':
            curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: text/xml"));
            curl_setopt($ch, CURLOPT_POST, TRUE);
            curl_setopt($ch, CURLOPT_POSTFIELDS, $xml);
            break;
        case 'PUT':
            curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: text/xml"));
            curl_setopt($ch, CURLOPT_POSTFIELDS, $xml);
            curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT');
            break;
        case 'DELETE':
            curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'DELETE');
            break;
        default:
            return FALSE;