<?php
if(isset($_REQUEST['driver_id']) && isset($_REQUEST['spat_ref'])) {

$driver_id= $_REQUEST['driver_id'];
$spat_ref = $_REQUEST['spat_ref'];


    
    $url = "https://api.fleeteng.com.au/v2/graph/role/jobs/$spat_ref/dispatches?access_token=9olkJkrIcttN8Zlh1lgAch70KFC_nJiIpUiCeaBMswbs";

$curlObj = curl_init();

curl_setopt($curlObj, CURLOPT_URL, "$url");
curl_setopt($curlObj, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curlObj, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($curlObj, CURLOPT_HEADER, 0);
curl_setopt($curlObj, CURLOPT_HTTPHEADER, array('Content-type:application/json'));
curl_setopt($curlObj, CURLOPT_POST, 1);
curl_setopt($curlObj, CURLOPT_POSTFIELDS, '[{"vehicle":{"id":' . $driver_id . '},"type":"dispatched"}]');



$response = curl_exec($curlObj);

curl_close($curlObj);
    
    	
    if(isset($response)){
    echo "OK";
    }
}

	    		
	    		
	    		