Add PHP server file
Signed-off-by: Will Beason <willbeason@gmail.com>
This commit is contained in:
parent
62db384aa4
commit
94454ffca3
24
index.php
Normal file
24
index.php
Normal file
@ -0,0 +1,24 @@
|
||||
<?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);
|
Loading…
Reference in New Issue
Block a user