Files
SGF/scripts/sgc-dispatch-receiver.php
T
2026-11-11 09:00:17 +02:00

10 lines
841 B
PHP

<?php
// Parent is the SGC application. Do not let its server-adapter cache/DB variables
// shadow the receiver harness's explicit isolated environment.
foreach(array_keys($_SERVER)as$key)if(preg_match('/^(APP_|DB_|SGF_|SESSION_|CACHE_|QUEUE_|BCRYPT_)/',$key))unset($_SERVER[$key]);
require __DIR__.'/sgc-invoice-proof-bootstrap.php';
$input=json_decode(file_get_contents($proofRoot.'/'.basename($argv[1])),true,128,JSON_THROW_ON_ERROR);
$headers=[];foreach(['Authorization'=>'HTTP_AUTHORIZATION','X-SGC-Client'=>'HTTP_X_SGC_CLIENT','X-SGC-Context'=>'HTTP_X_SGC_CONTEXT']as$from=>$to)$headers[$to]=$input['headers'][$from]??null;
$r=$send($input['body']??[],$input['headers']['X-Idempotency-Key']??null,$headers,$input['path'],null,$input['method']);
file_put_contents($proofRoot.'/'.basename($argv[2]),json_encode($r,JSON_THROW_ON_ERROR));