File: C:/xampp/htdocs/myapi/getCMYK.php
<?php
// Assuming your PHP script interacts with a database or performs some other logic to generate data
// For this example, let's assume it generates a simple JSON response
// Sample data for demonstration purposes
error_reporting(0);
$getL=$_GET['L'];
$geta=$_GET['a'];
$getb=$_GET['b'];
////////////////////////////////////////////////////////////////////////////////////////////////
$myFile ="labOne.txt";
$fvcc = fopen($myFile, 'w') or die("can't open file");
$viHeadM='CGATS.17
ORIGINATOR "icctrans"
#
# Data follows
#
NUMBER_OF_SETS 1
NUMBER_OF_FIELDS 4
BEGIN_DATA_FORMAT
SAMPLE_ID LAB_L LAB_A LAB_B
END_DATA_FORMAT
BEGIN_DATA';
fwrite($fvcc, $viHeadM."\n");
$labdata='1 '.$getL.' '.$geta.' '.$getb.' ';
fwrite($fvcc, $labdata."\n");
$enddata='END_DATA';
fwrite($fvcc, $enddata."\n");
fclose($fvcc);
$command = escapeshellcmd('icctrans.exe -i *Lab -o CRPC6.icc -t 3 labOne.txt cmyOne.txt');
//$command = escapeshellcmd('icctrans.exe -i *Lab -o ep360Auto.icm -t 3 labOne.txt rgbOne.txt');
$output = shell_exec($command);
sleep(1);
$contentTx = file("cmyOne.txt");
$stringTx = implode($contentTx);
$stringTx = str_replace("\r", " ", $stringTx);
$dotTx = explode(" ", $stringTx);////Measure upload
//print_r ($dotTx);
$TC=round($dotTx[19],0);
$TM=round($dotTx[20],0);
$TY=round($dotTx[21],0);
$TK=round($dotTx[22],0);
$data = array(
'getC' => $TC,
'getM' => $TM,
'getY' => $TY,
'getK' => $TK
);
// Encode the data as JSON
$jsonData = json_encode($data);
// Set the response header to indicate that the content is JSON
header('Content-Type: application/json');
// Output the JSON data
echo $jsonData;
?>