<?php

$path = $_SERVER['PATH_INFO'] ?? '';
$token = ltrim($path, '/');

$url="https://paiement.systempay.fr/t/".$token;
$ch = curl_init($url);

// Execute
curl_exec($ch);
if ($ch===false) {
        echo "Content-type: text/html; charset=utf-8\r\n\r\nerror";
        exit();
}

$info = curl_getinfo($ch);
$newURL=str_replace("systempay","sytempay",$info["redirect_url"]);
curl_close($ch);

header('Location: '.$newURL);
die();

?>
