mediawiki_dump_tools/index.php
Will Beason 94454ffca3 Add PHP server file
Signed-off-by: Will Beason <willbeason@gmail.com>
2025-06-23 14:17:53 -05:00

25 lines
541 B
PHP

<?php
// 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, 0);
$previous = $value;
}
echo json_encode($result);