29 lines
708 B
PHP
29 lines
708 B
PHP
<?php
|
|
|
|
header("Cache-Control: no-store, no-cache, must-revalidate, max-age=0");
|
|
header("Cache-Control: post-check=0, pre-check=0", false);
|
|
header("Pragma: no-cache");
|
|
|
|
// Launch this server with:
|
|
// php -S localhost:8000 -q -c php.ini
|
|
|
|
// Call the server with:
|
|
// curl -X POST -H "Content-Type: application/json" \
|
|
// -d '{"arg1": "aa", "arg2": "aba"}' \
|
|
// http://localhost:8000
|
|
|
|
// Get the raw POST data
|
|
$rawData = file_get_contents('php://input');
|
|
|
|
// Decode the JSON data
|
|
$data = json_decode($rawData, true);
|
|
|
|
$previous = '';
|
|
$result = [];
|
|
foreach ($data as $i => $value) {
|
|
$result[] = wikidiff2_inline_json_diff($previous, $value, 5000000);
|
|
$previous = $value;
|
|
}
|
|
|
|
echo json_encode($result);
|