<?php
$input = "code=0&message=OK&transId=XXXX-XXXX-XXXX&redirect=https%3A%2F%2Fpay1.comgate.cz%2Finit%3Fid%3DXXXX-XXXX-XXXX";
// Použití parse_str pro zpracování query stringu
parse_str($input, $map);
echo "Code:\n " . $map['code'] . PHP_EOL;
echo "Message:\n " . $map['message'] . PHP_EOL;
echo "TransId:\n " . $map['transId'] . PHP_EOL;
echo "Redirect:\n " . $map['redirect'] . PHP_EOL;